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

Add nonce csp capability #316

Open
wants to merge 1 commit into
base: v1.x/staging
Choose a base branch
from

Conversation

1000TurquoisePogs
Copy link
Member

This PR adds the ability for plugins to request use of a csp nonce and have their primary html be a template in which the nonce value is filled in when sent. This should allow plugins such as the desktop to be able to use a nonce in csp rules. Alternative CSP settings could be added in the future to use nonce in more situations.

@@ -199,6 +199,10 @@ function getPresetHeader(name, preset, req) {
return `default-src 'self' ${req.hostname};`;
} else if (preset == 'frame-strict') {
return `frame-src 'self' ${req.hostname};`;
} else if (preset == 'script-nonce') {
let nonce=crypto.randomBytes(16).toString('hex');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering whether the approach with a random string would be suitable for HA mode when there are multiple app-servers running.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, probably not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready for Review
Development

Successfully merging this pull request may close these issues.

2 participants