Skip to content

External script loading triggers Chrome Web Store rejection #1283

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

Open
kyranjamie opened this issue Apr 29, 2025 · 0 comments
Open

External script loading triggers Chrome Web Store rejection #1283

kyranjamie opened this issue Apr 29, 2025 · 0 comments

Comments

@kyranjamie
Copy link

kyranjamie commented Apr 29, 2025

Our team @leather-io authors a Web Extension released to the Chrome Web Store. Our extension publish has seen a rejection owning to Segment's use of external script loading.

As part of the Manifest v3 update, extensions are not allowed to remotely load code. This is a complete blocker for all MV3 extensions that use Segment.

In 2023, I opened an MV3 issues before regarding better support for services workers, which has so far not been prioritised by Segment #907

Rejection email

Image

Offending code here

export function getLegacyAJSPath(): string {
const writeKey = embeddedWriteKey() ?? getGlobalAnalytics()?._writeKey
const scripts = Array.prototype.slice.call(
document.querySelectorAll('script')
)
let path: string | undefined = undefined
for (const s of scripts) {
const src = s.getAttribute('src') ?? ''
const result = analyticsScriptRegex.exec(src)
if (result && result[1]) {
path = src
break
}
}
if (path) {
return path.replace('analytics.min.js', 'analytics.classic.js')
}
return `https://cdn.segment.com/analytics.js/v1/${writeKey}/analytics.classic.js`
}

The only way we've managed to fix this so far, is by using our bundler to override this fn with the remote injection code overridden.

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

No branches or pull requests

1 participant