-
Notifications
You must be signed in to change notification settings - Fork 198
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
fix: workaround for the issue with chrome.runtime.getURL introduced in Chrome 130 causing CSP rejecting script due to different origin (GUID instead of chrome extension id) #928
Conversation
🦋 Changeset detectedLatest commit: 9cdc3e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
1f2dd1a
to
58f5e0d
Compare
@jacksteamdev could you please take a look? |
shouldn't we also address |
58f5e0d
to
04855df
Compare
I tried to use this changes in index c543f3e..654ed0d 100644
--- a/node_modules/@crxjs/vite-plugin/dist/index.mjs
+++ b/node_modules/@crxjs/vite-plugin/dist/index.mjs
@@ -1805,7 +1805,7 @@ function compileFileResources(fileName, {
const defineManifest = (manifest) => manifest;
const defineDynamicResource = ({
matches = ["http://*/*", "https://*/*"],
- use_dynamic_url = true
+ use_dynamic_url = false
}) => ({
matches,
resources: [DYNAMIC_RESOURCE],
@@ -1839,7 +1839,7 @@ const pluginWebAccessibleResources = () => {
// all resources are web accessible
resources: ["**/*", "*"],
// change the extension origin on every reload
- use_dynamic_url: true
+ use_dynamic_url: false
};
if (browser === "firefox") {
delete war.use_dynamic_url; The iplementation from this PR works for me though xc2/follow-it-later#22 |
I think you updated the wrong lines. You should update the values on lines 1842 and 1924 |
We're excited about this patch. Our Extension is dead in the water till this is merged and deployed. |
@tance77 in the meantime you can patch the tool with patch-package, check #918 (comment) |
04855df
to
d6a90eb
Compare
This is also in issue: #929 The simplest fix to get this working again is updating: Although I've validate the above patch in this PR works for me as well. |
…using CSP rejecting script due to different origin (GUID instead of chrome extension id)
d6a90eb
to
9cdc3e7
Compare
Thanks @onv ! When can this PR be merged and released? A lot of dev is at a standstill without manual patching. |
@jacksteamdev, can this PR be merged? Looks like I still need an approval from maintainer. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @onv for putting this together!
This landed in 2.0.0-beta.26 |
Confirming this is all working well now! Thank you!
…On Sun, Oct 20, 2024 at 1:37 PM Jack Steam ***@***.***> wrote:
This landed in 2.0.0-beta.26
***@***.***/vite-plugin/v/2.0.0-beta.26>
—
Reply to this email directly, view it on GitHub
<#928 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGK3LCAV65KFJLMYYHILT3Z4QIBXAVCNFSM6AAAAABQDD627KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRVGIYTANZQGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
2.0.0-beta26 |
@tance77 If this is still happening for you, please create an issue so we can reproduce it. |
What is the version of Vite to use for this? import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { crx } from '@crxjs/vite-plugin'
import manifest from './manifest.json'
export default defineConfig({
plugins: [
react(),
crx({ manifest }),
],
}) Tried this configs #939 (comment) but the error is persistent. |
Anyone able to resolve the issues of #939 (comment) |
fix: workaround for the issue with chrome.runtime.getURL introduced in Chrome 130 causing CSP rejecting script due to different origin (GUID instead of chrome extension id)
Starting Chrome 130
use_dynamic_url
has taken an effect and as a result chrome.runtime.getURL(path) now returns url with random GUIDchrome-extension://1d4b08e1-f2c5-48e5-839d-32c125e7a989/${path}
instead ofchrome-extension://${chrome.runtime.id}/${path}
Setting
use_dynamic_url
tofalse
or replacing chrome.runtime.getURL() with template stringchrome-extension://${chrome.runtime.id}/${path}
solves the issue.The related issue