Opened 5 weeks ago

Last modified 2 weeks ago

#31757 assigned New feature

Adjust default SECRET_KEY to use `dj::insecure` prefix and add matching deployment system check.

Reported by: Carlton Gibson Owned by: kosc
Component: Core (System checks) Version: master
Severity: Normal Keywords:
Cc: René Fleschenberg, Shai Berger Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Recent thread on the mailing list about making the default settings more 12 factor friendly. (Related to similar discussions in say #20081.)

Conclusion there was that environment variables are only one way to go. (...)

In the discussion it came up that we could prefix the generated SECRET_KEY with say, dj::insecure and then add a deployment system check to ensure that wasn't used in production. (Paraphrasing various points: might not be 100% robust but would capture most cases.)

So:

  • Prefix secret key in project template.
  • Add system check to ensure secret key does not have prefix.

Change History (7)

comment:1 Changed 5 weeks ago by felixxm

Triage Stage: UnreviewedAccepted
Version: 3.0master

comment:2 Changed 5 weeks ago by René Fleschenberg

Shai Berger suggested an alternative approach: Marking the string as insecure by making it an instance of a custom str subclass (https://groups.google.com/d/msg/django-developers/CIPgeTetYpk/3a0lkAu-BgAJ). I am not sure which of the two approaches we prefer.

comment:3 Changed 5 weeks ago by René Fleschenberg

Cc: René Fleschenberg added

comment:4 in reply to:  2 ; Changed 5 weeks ago by felixxm

Cc: Shai Berger added

Replying to René Fleschenberg:

Shai Berger suggested an alternative approach: Marking the string as insecure by making it an instance of a custom str subclass (https://groups.google.com/d/msg/django-developers/CIPgeTetYpk/3a0lkAu-BgAJ). I am not sure which of the two approaches we prefer.

Prefix is fine, IMO.

comment:5 Changed 4 weeks ago by felixxm

Has patch: set
Owner: changed from nobody to kosc
Status: newassigned

comment:6 Changed 3 weeks ago by Carlton Gibson

Patch needs improvement: set

comment:7 in reply to:  4 Changed 2 weeks ago by Shai Berger

Replying to felixxm:

Replying to René Fleschenberg:

Shai Berger suggested an alternative approach: Marking the string as insecure by making it an instance of a custom str subclass

Prefix is fine, IMO.

Missed this earlier... prefix is fine IMO too.

Note: See TracTickets for help on using tickets.
Back to Top