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

Register URL pattern as bypassing CSP? #10180

Open
alexstrat opened this issue Aug 2, 2017 · 3 comments
Open

Register URL pattern as bypassing CSP? #10180

alexstrat opened this issue Aug 2, 2017 · 3 comments

Comments

@alexstrat
Copy link
Contributor

alexstrat commented Aug 2, 2017

Since v0.30.3 we can register URL schemes (http, file, chrome-extension.. ) as bypassing CSP via webFrame.registerURLSchemeAsBypassingCSP.

Is there a way to register URL patterns (like https://mydomain.com/trusted-scripts/*) as bypassing CSPs?
If no, would it make sense to add such an API (webFrame.registerURLPatternAsBypassingCSP I guess)?
Any idea where I should start the implementation from on Chromium side?

@alexstrat
Copy link
Contributor Author

alexstrat commented Aug 2, 2017

Use blink::WebSecurityPolicy::addOriginAccessWhitelistEntry ?
Took inspiration from this

@felixrieseberg
Copy link
Member

You could already enable this behavior by combining a custom protocol with a custom protocol handler. That said, I could see this API working out. If you'd be willing to make a PR, you might find this in core.

@alexstrat
Copy link
Contributor Author

@felixrieseberg by "combining a custom protocol with a custom protocol handler" you meant this:

  • load URLs mydomain://trusted-scripts/a.js instead of https://mydomain.com/trusted-scripts/a.js
  • handle custom protocol mydomain: in handler fetch external scripts (https://mydomain.com/trusted-scripts/a.js) and serve as it
  • registerURLSchemeAsBypassingCSP('mydomain')

That's it?

Actually, I'm not controlling the URLs loaded, it's external content loaded via webview, so can't use this workaround.

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

No branches or pull requests

3 participants