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