-
Notifications
You must be signed in to change notification settings - Fork 3
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
Bypass CSP for img.src in Chromium #33
Comments
Not exactly about CSP, but probably solving this problem will also help to bypass bypass CORS for some imagery |
https://chromewebstore.google.com/detail/allow-csp-content-securit/hnojoemndpdjofcdaonbefcfecpjfflh it can disable CSP on the site. also: https://chromewebstore.google.com/detail/csp-unblock/lkbelpgpclajeekijigjffllhigbhobd |
Perhaps a solution to problems with Leaflet may be available after: Tampermonkey/tampermonkey#2053 |
The solution is specific:
Chrome — сосать, CSP — сосать |
Currently, switching satellite images only works in Firefox. It is implemented by simply replacing the src tag
better-osm-org/better-osm-org.user.js
Line 749 in 00555e8
But this does not work in Chromium, which for some reason takes into account image-src CSP
Create an
with the desired tile using GM_AddElement, and call replaceWith()
better-osm-org/better-osm-org.user.js
Lines 751 to 756 in 00555e8
But this breaks Leaflet: when zooming in, new tiles are not loaded (you can get around it by switching tiles twice)
replaceWith probably breaks tile object references that are important for Leaflet. (event handlers?)
I have no idea how to overcome this or even understanding how GM_addElement bypasses CSP
Interesting points in the ViolentMonkey source code
https://github.com/violentmonkey/violentmonkey/blob/692ffb97743fbbcd549d1ed81969e915125ebfd7/src/injected/content/gm-api-content.js#L31
https://github.com/violentmonkey/violentmonkey/blob/692ffb97743fbbcd549d1ed81969e915125ebfd7/src/background/utils/preinject.js#L625
The text was updated successfully, but these errors were encountered: