Skip to content

Commit

Permalink
fixup! mozillaGH-36 Disallow mixing deprecated settings with CSP_POLI…
Browse files Browse the repository at this point in the history
…CY_DEFINITIONS
  • Loading branch information
DylanYoung committed May 26, 2022
1 parent 0a947e2 commit 0b1b649
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions csp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,7 @@
http_client.NOT_FOUND,
}


def get_declared_policy_definitions():
custom_definitions = csp_definitions_update(
{},
getattr(
settings,
'CSP_POLICY_DEFINITIONS',
{'default': {}},
),
)
deprecation._handle_legacy_settings(
custom_definitions['default'],
allow_legacy=not hasattr(settings, 'CSP_POLICY_DEFINITIONS'),
)
definitions = csp_definitions_update(
{},
{name: defaults.POLICY for name in custom_definitions}
)
for name, csp in custom_definitions.items():
definitions.setdefault(name, {}).update(csp)
return definitions


def get_declared_policies():
return getattr(settings, 'CSP_POLICIES', defaults.POLICIES)
SINGLE_POLICY_KWARGS = {directive_to_setting(d, prefix='') for d in DIRECTIVES}


def _normalize_config(config, key='default'):
Expand Down

0 comments on commit 0b1b649

Please sign in to comment.