CSP best practice #709

Closed
opened 2026-02-04 21:58:31 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @TBK on GitHub (Jun 8, 2018).

CSP deems inline CSS & JS unsafe - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src

Currently BookStack requires `Content-Security-Policy: style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';`` because of the inline CSS code in https://github.com/BookStackApp/BookStack/blob/master/resources/views/partials/custom-styles.blade.php and JS code https://github.com/BookStackApp/BookStack/blob/master/resources/views/settings/index.blade.php#L162

Another CSP issue is with the use of .globalEval in app.js.

Would a possible solution for custom-styles.blade.php be to move the css code to a file and update the file when the value is changed through the settings page?

I have not been able to trace .globalEval but I think it is coming from jQuery.

Originally created by @TBK on GitHub (Jun 8, 2018). CSP deems inline CSS & JS unsafe - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src Currently BookStack requires `Content-Security-Policy: style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';`` because of the inline CSS code in https://github.com/BookStackApp/BookStack/blob/master/resources/views/partials/custom-styles.blade.php and JS code https://github.com/BookStackApp/BookStack/blob/master/resources/views/settings/index.blade.php#L162 Another CSP issue is with the use of .globalEval in app.js. Would a possible solution for custom-styles.blade.php be to move the css code to a file and update the file when the value is changed through the settings page? I have not been able to trace .globalEval but I think it is coming from jQuery.
OVERLORD added the 🛠️ Enhancement label 2026-02-04 21:58:31 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Nov 8, 2022):

I'm going to close this off since the CSP situation in BookStack has changed since this request. CSP is now built-in using nonce-based CSP rules.

@ssddanbrown commented on GitHub (Nov 8, 2022): I'm going to close this off since the CSP situation in BookStack has changed since this request. CSP is now built-in using nonce-based CSP rules.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#709