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

chrome userScript world proof of concept #2149

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

marcustyphoon
Copy link

@marcustyphoon marcustyphoon commented Oct 23, 2024

I kind of doubt the extension stores would count this as kosher, but.

This is an incomplete but working proof of concept for running the entirety of New XKit in Chrome's MV3 "userScript" world, which is kind of like ISOLATED except you're allowed to run strings (not currently used) and set CSP. Firefox will get this feature eventually.

This version uses script-src 'self' 'unsafe-inline' 'unsafe-eval' as the CSP value, which is of course not particularly secure; in this form what the PR does is effectively whitelisting the privileged extension APIs our insecurely-executed-out-of-storage code can access. We basically only need storage.local.

There's no technical reason one can't remove 'unsafe-inline' (using XKit Rewritten's MV3 injection method; I have this implemented in test builds already) or even potentially 'unsafe-eval' (by grabbing the enabled script bodies from storage in the background script and injecting them as part of the browser.userScripts.update call; this sounds rather annoying to refactor). Doing both of those would be fairly interesting.

But doing the rest of this work and bugfixing the large number of ways to break things using mismatched stored script versions would be waiting on a Firefox implementation and gambling on the extension stores considering this a valid use of the new userScript API, just in order to preserve the XKit Editor functionality in an extension that's, to a first-order approximation, broken. Simply following the MV3 guidelines and removing the editor is a simpler way to let this codebase live on.

@marcustyphoon marcustyphoon force-pushed the mv3-userscript-dev-branch-1 branch from bacee48 to 3d9eb6b Compare November 16, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant