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

CSP: firefox reports are not triggering events #2475

Closed
shekyan opened this issue Dec 19, 2015 · 8 comments
Closed

CSP: firefox reports are not triggering events #2475

shekyan opened this issue Dec 19, 2015 · 8 comments
Assignees

Comments

@shekyan
Copy link

shekyan commented Dec 19, 2015

Firefox 42 generates CSP violation reports that are visible in the diagram on the dashboard, but no events are generated.

@mattrobenolt
Copy link
Contributor

Do you have a page that reproduces? I'm curious what the payload was that was sent. It's likely that it got filtered out as garbage, but can't say for sure without knowing the payload. :)

@mattrobenolt mattrobenolt self-assigned this Dec 19, 2015
@shekyan
Copy link
Author

shekyan commented Dec 19, 2015

Hard to tell, because Firefox doesn't capture the POST body when you do copy as cURL.
However, it is reproducible with FF 43.0.1 on OSX now on my web app at cspvalidator.org .
Response for the report is 403: Invalid CSP Report: Invalid value for 'effective-directive' .
Here is the POST message I got through Copy POST Data:

{"csp-report":{"blocked-uri":"self","document-uri":"https://cspvalidator.org/","original-policy":"default-src 'none'; script-src https://cspvalidator.org https://www.google-analytics.com https://code.jquery.com https://maxcdn.bootstrapcdn.com; img-src https://cspvalidator.org https://www.google-analytics.com; font-src https://cspvalidator.org https://fonts.gstatic.com https://bootswatch.com; connect-src https://cspvalidator.org; style-src https://cspvalidator.org https://bootswatch.com https://fonts.googleapis.com; frame-ancestors 'none'; form-action https://cspvalidator.org; report-uri https://app.getsentry.com/api/61840/csp-report/?sentry_version=5&sentry_key=fa6dfb4b9f18472ea63004645f521c17","referrer":"","source-file":"https://cspvalidator.org/","violated-directive":"style-src https://cspvalidator.org https://bootswatch.com https://fonts.googleapis.com"}}

@mattrobenolt
Copy link
Contributor

Ah, yes, because the report is missing the effective-directive entirely. See: http://www.w3.org/TR/CSP/#violation-report-effective-directive

Without this value on our side, it makes it much much harder to group effectively, so we discard reports that don't include it since the spec suggests that it should exist.

@mattrobenolt
Copy link
Contributor

We ultimately end up grouping on this: https://github.com/getsentry/sentry/blob/master/src/sentry/interfaces/csp.py#L141

So we attempt to group on something like: ('script-src', 'example.com') and without the effective-directive, we don't really know what the violation was.

I guess in your case though, violated-directive is being sent, so in theory, we could try and parse that to extract the effective-directive out of it, but I'm not sure that's worth the effort.

Unless I've misunderstood, it seems that effective-directive should be sent, and some older browsers do not do that.

Do you know if this is correct in FF 43? (I can check if you don't know off hand).

@shekyan
Copy link
Author

shekyan commented Dec 19, 2015

Apparently there is issue reported on this: https://bugzilla.mozilla.org/show_bug.cgi?id=1192684 .

@mattrobenolt
Copy link
Contributor

Ah. Yeah, this comment sums up my findings as well: https://bugzilla.mozilla.org/show_bug.cgi?id=1192684#c4

@shekyan is there anything else to add to this? Or can we close? I'm going to err on the side that this is Mozilla's job to implement this into Firefox and there's not much we can do here otherwise.

@shekyan
Copy link
Author

shekyan commented Dec 19, 2015

Let's just pray and hope.

@shekyan shekyan closed this as completed Dec 19, 2015
@mattrobenolt
Copy link
Contributor

🙏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants