next-safe icon indicating copy to clipboard operation
next-safe copied to clipboard

feat(buildCSPHeaders): allow merging of default directives

Open sambauers opened this issue 2 years ago • 1 comments

Allow the setting of contentSecurityPolicy.mergeDefaultDirectives which allows CSP directives defined in config to be additive to the default directives defined in next-safe.

Also allow interpretation of string directives, e.g. "'self' data:" and split these in order to merge and de-duplicate against defaults.

In addition, deal with the possibility of duplicates when merging in development default CSP directives.

Update documentation to convey new option and usage.

sambauers avatar Apr 14 '22 01:04 sambauers

This is a feature request presented as a PR. Happy to work through any changes or preferences around how this should be implemented, or if you don't want to enable this then that's OK too.

I simply found it kind of annoying that as soon as I wanted to add another script or style source, that I had to specify the defaults again.

Provided as an "opt-in" setting in this implementation as it could have unexpected consequences for people's existing configs.

sambauers avatar Apr 14 '22 01:04 sambauers

:tada: This PR is included in version 3.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Dec 04 '22 03:12 github-actions[bot]