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

Hability to configure request-specific nonce on CSP #1

Open
gtramontina opened this issue Dec 6, 2023 · 2 comments
Open

Hability to configure request-specific nonce on CSP #1

gtramontina opened this issue Dec 6, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@gtramontina
Copy link

Hey there. First of all, thank you for this port!

I've been looking for ways of configuring CSP directives to include nonces, like we can in the express version:

directives: {
  scriptSrc: ["'self'", (req, res) => `'nonce-${res.locals.cspNonce}'`],
  styleSrc: ["'self'", (req, res) => `'nonce-${res.locals.cspNonce}'`],
},

This doesn't seem to be possible in this port. Am I missing something or is this potentially a gap in parity?

Cheers!

@DevTobias
Copy link
Collaborator

Hi! I think this is not possible right now. I can try to implement this if I find the free time for it. Also feel free to open a pr for this, I would gladly take a look at it :)

@gtramontina
Copy link
Author

Thanks, @DevTobias. I can't promise a PR, but might eventually do it. From a quick glance at the codebase, it seems we'll need to forward both request and response from the plugin definition into the CSP policy in order to enable something like the above.

@DevTobias DevTobias added the enhancement New feature or request label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants