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

RPC intercepts not possible for apps setting CSPs in meta tags #132

Open
jfschwarz opened this issue Aug 16, 2024 · 0 comments
Open

RPC intercepts not possible for apps setting CSPs in meta tags #132

jfschwarz opened this issue Aug 16, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jfschwarz
Copy link
Collaborator

jfschwarz commented Aug 16, 2024

We intercept RPC requests made by apps by enabling redirects to the fork RPC via declarativeNetRequest session rules. Unfortunately, the redirect target URL falls under the apps content security policies, so might be blocked. For that reason we disable CSPs for apps loaded in Pilot.

This works when CSPs are set in response headers, but there's an alternative way of setting them using <meta http-equiv> tags. Our header override solution only disables CSPs set in response headers, not those set through meta tags.
As a result RPC intercepts don't work for apps using such meta tags. An example is https://app.uniswap.org.

Unfortunately, there's no easy way to disable such CSPs. See this discussion about declarativeNetRequest: w3c/webextensions#169 (comment)

There's this extension that allows to fully disable CSPs set through either option: https://github.com/lisonge/Disable-CSP/blob/main/src/devtools.ts However, apparently it requires dev tools to be open for removing meta tags. 😒

We could try to build a service worker processing html doc responses and removing the tags, but not sure if this will work.

@jfschwarz jfschwarz added the bug Something isn't working label Aug 16, 2024
@jfschwarz jfschwarz self-assigned this Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant