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

Fixes #21854: Properly configure CSP violation handler #4512

Conversation

amousset
Copy link
Member

@amousset amousset requested a review from fanf September 25, 2022 21:20
@amousset
Copy link
Member Author

Produces logs like:

WARN  application - Content security policy violation: blocked inline in https://127.0.0.1:8181/rudder/ because of script-src-elem directive

@amousset
Copy link
Member Author

PR updated with a new commit

@@ -362,6 +364,12 @@ class Boot extends Loggable {
// the session itself.
LiftRules.noCometSessionCmd.default.set(() => JsCmd.unitToJsCmd(()))

// Log CSP violations
LiftRules.contentSecurityPolicyViolationReport = (r: ContentSecurityPolicyViolation) => {
ApplicationLogger.warn(s"Content security policy violation: blocked ${r.blockedUri} in ${r.documentUri} because of ${r.violatedDirective} directive")
Copy link
Member Author

@amousset amousset Sep 25, 2022

Choose a reason for hiding this comment

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

I haven't investigated how to log it the right context, Application looks a bit too generic.

Copy link
Member

Choose a reason for hiding this comment

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

Seems correct to me

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/4512
-- Your faithful QA
Kant merge: "Happiness is not an ideal of reason, but of imagination."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/60331/console)

@amousset
Copy link
Member Author

OK, squash merging this PR

@amousset amousset force-pushed the arch_21854/properly_configure_csp_violation_handler branch from 3aa6d2f to bdcacd7 Compare September 27, 2022 14:55
@amousset amousset merged commit bdcacd7 into Normation:master Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants