security(git-id-switcher): tighten CSP img-src from wildcard to explicit subdomain#462
Conversation
…cit subdomain - Replace `*.githubusercontent.com` with `avatars.githubusercontent.com` in buildCspString img-src to prevent loading arbitrary files from attacker-controlled repositories via raw.githubusercontent.com - Add scoped absence tests that extract the img-src directive and verify wildcard / raw.githubusercontent.com are not present - Move `coerceLang` and `STYLE_CLOSE_PATTERN` from csp.ts to shell.ts to align module boundaries (shell-rendering vs CSP concerns) - Update ARCHITECTURE.md CSP section to reflect current policy - Add shell.ts to ESLint regex-constant allowlist Signed-off-by: Null;Variant <null@nullvariant.com> 🖥️ IDE: [VS Code](https://code.visualstudio.com/) 🔌 Extension: [Claude Code](https://claude.ai/download) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Model-Raw: claude-opus-4-6
🦥 Slow's Code Review 😩...yawn... Do I really have to review this?
| Split it up... reading long files is exhausting.
This review was reluctantly filed by nullvariant-slow[bot] |
🐰 Mimi's Validation Report ✅All checks are looking good! Great job! 🎉 ⏳ Some checks are still running. I will keep watching!
This report was carefully prepared by nullvariant-mimi[bot] |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
🕊️ Ciel's Mediation 🌤️*~~ floating down from the clouds ~~ The zoo seems a bit noisy today...* 2 zoo members have reviewed this PR.
⚖️ The zoo has mixed opinions. Some are concerned, some are fine with it. Please review each comment carefully and make the final call.
This mediation was peacefully delivered by nullvariant-ciel[bot] |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|



Summary
*.githubusercontent.comwithavatars.githubusercontent.cominbuildCspStringimg-src to prevent loading arbitrary files from attacker-controlled repositoriesimg-srcdirective and verify wildcard /raw.githubusercontent.comare not presentcoerceLangandSTYLE_CLOSE_PATTERNfromcsp.tstoshell.tsto align module boundaries (shell-rendering vs CSP concerns)ARCHITECTURE.mdCSP section to reflect the current policyshell.tsto ESLint regex-constant allowlistTest plan
npx tsc --noEmit)*.githubusercontent.comandraw.githubusercontent.comare not inimg-srcavatars.githubusercontent.comis inimg-src