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

[MV3] Firefox RPC access broken due to CORS #1244

Closed
Tracked by #1152
lidel opened this issue Jul 21, 2023 · 4 comments
Closed
Tracked by #1152

[MV3] Firefox RPC access broken due to CORS #1244

lidel opened this issue Jul 21, 2023 · 4 comments
Assignees
Labels
kind/bug A bug in existing code (including security flaws) mv3-beta-bugs P0 Critical: Tackled by core team ASAP

Comments

@lidel
Copy link
Member

lidel commented Jul 21, 2023

Found during review of #1182

Something broke RPC API access in Firefox, requests get blocked by CORS, which suggests the Origin HTTP header override we do here no longer does its job and access to RPC port is not safelisted correctly.

2023-07-21_19-01

My gut feeling is the cause is switching onBeforeRequest to async, but there could be other reason.

@lidel lidel added need/triage Needs initial labeling and prioritization mv3-beta-bugs kind/bug A bug in existing code (including security flaws) labels Jul 21, 2023
@github-project-automation github-project-automation bot moved this to Needs Grooming in IPFS-GUI (PL EngRes) Jul 22, 2023
@SgtPooki SgtPooki moved this from Needs Grooming to Prioritized / Ready for Dev in IPFS-GUI (PL EngRes) Jul 24, 2023
@SgtPooki SgtPooki added P0 Critical: Tackled by core team ASAP and removed need/triage Needs initial labeling and prioritization labels Jul 24, 2023
@SgtPooki
Copy link
Member

assigned to @whizzzkid

@lidel
Copy link
Member Author

lidel commented Jul 26, 2023

@whizzzkid one thing you could try is to register a separate, synchronous onBeforeRequest when runtime supports blocking webRequest (blocking means you can modify headers).
This way you don't need to undo all the async/await refactoring you did for MV3, but we still should be able to fixup the Origin header in Firefox.

ps. worst case, if we can't make it work, we need to be pragmatic, given the browser market share and the fact MV2 works just fine: if you see there is too much work to make it work, we could keep Firefox on MV2 for now (create mv2 branch from the last release).

@whizzzkid
Copy link
Contributor

@lidel well actually I did not face it (to begin with), upon further investigation, it's a bit more nuanced, the culprit is the new host_permisssions and how browsers cannot agree on how to treat these, hence different browsers treat these differently, firefox may treat these as optional, chrome treats this as required. Which means, this needs to be explicitly requested. This has changed since permissions: [ ..., "<all_urls>", ...] is no longer a thing.

host_permissions

Requesting permissions is also now a cumbersome process, the browser won't let us raise a request to grant perms from any script, it needs to explicitly come from a user-input action, which means we need to create an input event that explicitly calls the request and then we can do anything with those perms.

Creating: #1250

@whizzzkid whizzzkid moved this from Prioritized / Ready for Dev to In Review in IPFS-GUI (PL EngRes) Jul 31, 2023
@whizzzkid
Copy link
Contributor

whizzzkid commented Aug 4, 2023

Closed with #1250

@github-project-automation github-project-automation bot moved this from In Review to Done in IPFS-GUI (PL EngRes) Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) mv3-beta-bugs P0 Critical: Tackled by core team ASAP
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants