-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Subresource Integrity and raven.js #2476
Comments
An example SRI loading wrapper that we use on our website can be found here |
I'm having a little bit of troubling understanding what exactly you're asking for, so lemme summarize what I understand about SRI: A website could use SRI for a resource inside of it's script tag to validate it's integrity with a sha256 hash of the expected contents. (or another hash algorithm like sha512, etc). If the verification fails, the script does not get loaded. raven-js publishes a list of it's SRI hashes along with the dist bundle, see: https://github.com/getsentry/raven-js/blob/master/dist/sri.json and https://cdn.ravenjs.com/1.3.0/sri.json. We can't enforce this on the CDN, but a user would need to do this on their side. So from my understanding, we could do a better job on promoting this on raven-js side for our own scripts, that'd work with our CDN. BUT, I think you're asking about reporting these issues from other scripts via raven-js, not using SRI for raven-js itself, correct? I think this is valid, but my concern is... what value does this report give to a developer? There are 2 major scenarios I think come into play here, and it's the same for the HPKP reporting:
If you flat our mess up, this would not be an isolated issue, and likely, it'd be 100% broken. So the reporting use case is limited. And if there's an attack going on, and SRI is doing the right thing... would a report be useful to you? Could you use that information to counteract? It seems more like an FYI situation. I also wonder how many false positives would come from this due to proxies and ISPs trying to do sketchy things. All things that are not actionable. Sorry if some of these are naiive, I'm just trying to figure out what we can do here and if it actually makes sense to be able to surface these things in Sentry. :) We try to make sure we're reporting useful things and not be noisy about things that are unactionable. |
Also, looking at your script, it looks like you're using the fallback to serve the asset from your domain, instead of the public CDN. Is this to protect against a compromised CDN? If there were an attack against the jQuery CDN, for example, falling back to your local copy is less likely to be compromised? I guess I'm thinking about this more like your entire network being compromised (using a sketchy ISP) where it doesn't really matter which domain, they're always trying to intercept data. I've heard horror stories of airplane wifi doing this kind of stuff, for example. |
You pretty much got my points right. Here are some clarifications:
The point of SRI is to not trust anybody (e.g. blindly use the value provided by third-party) but, say, do security code review and if ok, calculate the SRI on your own and assume it's good to be used with . The backup source in our case, and I guess in most of the other cases is the local copy of the file that I reviewed already, but serving it from CDN should me much faster than from myself. So, if CDN is hacked, or a targeted attack is happening, or third-party developer pushed new change into the same resource (like bootswatch does), website still continues to work as expected, by maybe load is slower. What I am asking is:
|
Closing this issue due to staleness. Feel free to comment here if you think we should still work on this. |
Subresource Integrity is promising new technology that allows to verify the integrity of third-party resources included by the web page, and provides a backup mechanism to load the resources from trusted (but slow) sources. Backup mechanism is just an
error
event, that needs to be handled by the developer.From what I understand, this flow does not align with the way raven.js should be deployed, e.g.
Since SRI does not provide reporting mechanism, and there is no common way of getting notified when integrity violation happens. I'd be happy to use Sentry for that purpose, but there is chicken and egg problem in regards to what load first: raven.js without verifying it's integrity or SRI loader script without hooking raven.js into it.
How do you think this can be solved? May be I am overcomplicating things and there is some obvious way to use sentry to monitor SRI exceptions.
The text was updated successfully, but these errors were encountered: