@@ -957,25 +957,64 @@ def init_sentry(before_send: Callable | None = None):
957
957
# ideally we'd use BASE_URI but it'd have to be lazy or cause issues
958
958
CSP_DEFAULT_SRC = [
959
959
"'self'" ,
960
- ] + config ("CSP_EXTRA_DEFAULT_SRC" , default = [], split = True )
960
+ ] + config (
961
+ "CSP_EXTRA_DEFAULT_SRC" ,
962
+ default = [],
963
+ split = True ,
964
+ group = "Content Security Policy" ,
965
+ help_text = "Extra default source URLs for CSP other than ``self``. "
966
+ "Used for ``img-src``, ``style-src`` and ``script-src``" ,
967
+ )
961
968
962
- CSP_REPORT_PERCENTAGE = config ("CSP_REPORT_PERCENTAGE" , 1.0 ) # float between 0 and 1
969
+
970
+ CSP_REPORT_URI = config (
971
+ "CSP_REPORT_URI" ,
972
+ None ,
973
+ group = "Content Security Policy" ,
974
+ help_text = "URI of the``report-uri`` directive." ,
975
+ )
976
+ CSP_REPORT_PERCENTAGE = config (
977
+ "CSP_REPORT_PERCENTAGE" ,
978
+ 0 ,
979
+ group = "Content Security Policy" ,
980
+ help_text = "Percentage of requests that get the ``report-uri`` directive." ,
981
+ ) # float between 0 and 1
963
982
964
983
CSP_FORM_ACTION = (
965
984
config (
966
985
"CSP_FORM_ACTION" ,
967
986
default = ["\" 'self'\" " ]
968
- + config ("CSP_EXTRA_FORM_ACTION" , default = [], split = True ),
987
+ + config (
988
+ "CSP_EXTRA_FORM_ACTION" ,
989
+ default = [],
990
+ split = True ,
991
+ group = "Content Security Policy" ,
992
+ help_text = "Add additional ``form-action`` source to the default " ,
993
+ ),
969
994
split = True ,
995
+ group = "Content Security Policy" ,
996
+ help_text = "Override the default ``form-action`` source" ,
970
997
)
971
998
+ CORS_ALLOWED_ORIGINS
972
999
)
973
1000
974
- CSP_IMG_SRC = CSP_DEFAULT_SRC + config ("CSP_EXTRA_IMG_SRC" , default = [], split = True )
1001
+ CSP_IMG_SRC = CSP_DEFAULT_SRC + config (
1002
+ "CSP_EXTRA_IMG_SRC" ,
1003
+ default = [],
1004
+ split = True ,
1005
+ group = "Content Security Policy" ,
1006
+ help_text = "Extra ``img-src`` sources for CSP other than ``CSP_DEFAULT_SRC``." ,
1007
+ )
975
1008
976
1009
# affects <object> and <embed> tags, block everything by default but allow deploy-time
977
1010
# overrides.
978
- CSP_OBJECT_SRC = config ("CSP_OBJECT_SRC" , default = ["\" 'none'\" " ], split = True )
1011
+ CSP_OBJECT_SRC = config (
1012
+ "CSP_OBJECT_SRC" ,
1013
+ default = ["\" 'none'\" " ],
1014
+ split = True ,
1015
+ group = "Content Security Policy" ,
1016
+ help_text = "``object-src`` urls" ,
1017
+ )
979
1018
980
1019
# we must include this explicitly, otherwise the style-src only includes the nonce because
981
1020
# of CSP_INCLUDE_NONCE_IN
0 commit comments