Issue Bug Closed

#105432Resolve placeholders in config/sites/*/csp.yaml

Sebastian Iffland 10/24/24, 09:10 updated 08/12/25, 14:36

Description

Current behavior

The csp.yaml file will not replace placeholders like %env(MY_VAR)%

Expected behavior

The csp.yaml is parsed like the config.yaml and replaces placeholders as described in documentation.

Steps to reproduce

Create config/sites/*/csp.yaml with content like:

inheritDefault: false
mutations:
  - mode: set
    directive: 'default-src'
    sources:
      - "'self'"
      - '%env(MAIN_SITE_BASE_URI)%'
      - '%env(SUB_SITE_BASE_URI)%'

As seen in sample, especially for multi-site systems, but also in single site environments this is helpful to keep base URL definition in central place which also reduce chance of spelling mistakes while defined in multiple files.

Reviews 3

History 27

  1. Sebastian Iffland commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2024-10-29T09:20:09+00:00" > 10/29/24, 09:20 </span>

    Applied in changeset commit:b5cc722fd16f061ddf80d97b4f1f2e4cf989cddd.