Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send a configurable CSP in every HTML response #9665

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Commits on Oct 29, 2024

  1. Send a configurable CSP in every HTML response

    The CSP gets adapted to remote objects being allowed or not.
    It can be configured or disabled via the config option
    `content_security_policy` (and
    `content_security_policy_add_allow_remote`).
    pabzm committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    801f375 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0d1b036 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3882b73 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6f00ac2 View commit details
    Browse the repository at this point in the history
  5. Add additional CSP header values only if present

    If people write a lax default CSP they might set the additional config
    option to the blank string, or false. Then the CSP header should not
    contain that value.
    pabzm committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    feb8e9f View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2024

  1. Configuration menu
    Copy the full SHA
    bc6b241 View commit details
    Browse the repository at this point in the history
  2. Use hardcoded defaults for CSP options

    This way the code always has values it can work with, no matter how good
    or broken the
    configuration is.
    pabzm committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    5db41a1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    383e8b5 View commit details
    Browse the repository at this point in the history
  4. Improve readability of CSP value checks

    Previously the code also treated `'false'` (the string) as invalid, but
    that's a very specific check against a specific edge case, which
    wouldn't even break the code (but will only make the browser complain),
    so I'm dropping that check.
    pabzm committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    8b631ab View commit details
    Browse the repository at this point in the history
  5. Fix static analysis.

    pabzm committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    10f7598 View commit details
    Browse the repository at this point in the history
  6. Fix CSP option type handling

    The config value might be something else than a string.
    pabzm committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    1afa897 View commit details
    Browse the repository at this point in the history
  7. Make CSP header building more robust.

    In the previous way useless semicolons could have happened.
    pabzm committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    37db3ef View commit details
    Browse the repository at this point in the history
  8. Remove type annotation because PHP v7

    We still support PHP v7, which doesn't support union types.
    pabzm committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    ef5aae3 View commit details
    Browse the repository at this point in the history
  9. Mitigate erronous complaint of phpstan

    phpstan complains that `assertIsArray($config)` will always fail because
    it doesn't know about the side effects of `require`ing the default
    config.
    pabzm committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    b1ea913 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    fda480b View commit details
    Browse the repository at this point in the history