You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In messing around with our CSP-handling code and looking at a bunch of example CSP events in the process of teaching the grouphash metadata helpers how to gather data on security reports, I discovered that we're interpreting the unsafe-eval and unsafe-inline keywords backwards.
This is from our logic which turns an incoming CSP report into a Sentry event:
If a page has a CSP header and ‘unsafe-eval’ ISN’T specified with the script-src directive, the following methods are blocked and won’t have any effect:
eval()
etc.
And it’s the same idea for unsafe-inline. So IOW, having one of those in your script-src directive ALLOWS eval and/or inline scripts, not blocks them.
According to the spec, inline script violations have blocked-uri: inline and eval violations have blocked-uri: eval, so it seems like that's what we should be looking for instead. (See point 4 here.)
UPDATE: Added getsentry/sentry#81531 to track making sure the sentry side of things is updated once this is fixed.
The text was updated successfully, but these errors were encountered:
…inputs (#81539)
This adds two new grouping test inputs, to show how we handle CSP reports with `unsafe-eval` and `unsafe-inline` violations, which are cases we don't currently cover with our grouping tests.
Note that there are two bugs which currently affect how we handle such inputs:
- We don't currently recognize such reports for grouping metadata purposes (this is very soon to be fixed), which is why for now they're being recorded in the metadata snapshots as being grouped by an unknown method.
- We handle such reports backwards at the ingest level, marking events which aren't either `unsafe-eval`- or `unsafe-inline`-type violations as one or the other. (Unclear how soon this will be fixed, as it went undetected for five years and no one has yet complained about it.) For now, the input data includes the necessary values to trigger the relevant handlers, but each also includes a `TODO` so that it can be updated once the underlying bug is fixed. (See getsentry/relay#4323 and #81531.)
In messing around with our CSP-handling code and looking at a bunch of example CSP events in the process of teaching the grouphash metadata helpers how to gather data on security reports, I discovered that we're interpreting the
unsafe-eval
andunsafe-inline
keywords backwards.This is from our logic which turns an incoming CSP report into a Sentry event:
relay/relay-event-schema/src/protocol/security_report.rs
Lines 329 to 332 in 9b39f40
But according to MDN (here, capitalization mine):
And it’s the same idea for
unsafe-inline
. So IOW, having one of those in yourscript-src
directive ALLOWS eval and/or inline scripts, not blocks them.According to the spec, inline script violations have
blocked-uri: inline
and eval violations haveblocked-uri: eval
, so it seems like that's what we should be looking for instead. (See point 4 here.)UPDATE: Added getsentry/sentry#81531 to track making sure the sentry side of things is updated once this is fixed.
The text was updated successfully, but these errors were encountered: