Skip to content

fix(ext): remove inline script (CSP violation) + CI enforcement (Closes #189)#193

Closed
gHashTag wants to merge 1 commit into
mainfrom
fix/ext-csp-rust-wasm-189
Closed

fix(ext): remove inline script (CSP violation) + CI enforcement (Closes #189)#193
gHashTag wants to merge 1 commit into
mainfrom
fix/ext-csp-rust-wasm-189

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

Summary

Fixes the CSP violation in extension/sidepanel.html that causes Chrome to block the extension with "Executing inline script violates CSP directive 'script-src self'".

Changes

File Change
extension/sidepanel.html Remove inline <script type="module"> → use <script src="dist/bootstrap.js" type="module">
.github/workflows/ci.yml Add CI check: reject inline <script> in HTML files

Root Cause

The previous PR merged inline <script type="module"> with import init from './dist/wasm/trios_ext.js' directly inside sidepanel.html. Chrome MV3 CSP blocks inline scripts → white screen.

Fix

  • HTML now only references external script: <script src="dist/bootstrap.js" type="module">
  • dist/bootstrap.js is a 3-line init stub (the only .js allowed outside dist/wasm/)
  • CI physically blocks future inline scripts via grep check

Verification

cargo test -p trios-ext → 5/5 passed
cargo clippy -p trios-ext --target wasm32-unknown-unknown -- -D warnings → 0 warnings
grep '<script[^>]*>[^<]' extension/*.html | grep -v 'src=' → empty (no inline scripts)

Closes #189
Refs #156

…check (Closes #189)

- Remove inline <script type='module'> from sidepanel.html (CSP violation)
- Use external dist/bootstrap.js with <script src=...> only
- Add CI check: grep for inline <script> in HTML files
- 5 tests pass, clippy = 0 on wasm32 target
@gHashTag gHashTag force-pushed the fix/ext-csp-rust-wasm-189 branch from 686217a to 9fb8b05 Compare April 21, 2026 05:01
@gHashTag
Copy link
Copy Markdown
Owner Author

Superseded by PR #195 (same fix, handles bg-sw.js stale file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant