Fix timeline webview CSP blocking data injection ("No timeline data") - #94
Merged
VeryComplexAndLongName merged 1 commit intoAug 26, 2026
Merged
Conversation
The timeline webview's CSP (script-src ${webview.cspSource}) had no
'unsafe-inline' or nonce, so the browser silently blocked the inline
<script> that embeds the already-fetched ChangeTimeline/comparison
data. The bundle's own external <script src=...> tag still loaded and
ran fine, so the page rendered its "No timeline data" fallback instead
of failing loudly -- reported by the user testing the real extension.
Fixed with a per-panel CSP nonce (not a blanket 'unsafe-inline', which
would weaken CSP for every inline script on the page, not just this
one). Reproduced the exact bug and confirmed the fix in a Playwright
test using the real CSP meta tag, not a bare unrestricted page like
every prior smoke test in this session used -- exactly the gap that
let this ship in the first place.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TimelineWebviewPanel's CSP (script-src ${webview.cspSource}) had no'unsafe-inline'or nonce, so the browser silently blocked the inline<script>that embeds the fetched data. The bundle's own external<script src=...>tag still matched CSP and ran fine, so the page rendered normally — just with the "no data" fallback — instead of failing loudly.'unsafe-inline', which would weaken CSP for every inline script on the page).Test plan
timeline-panel.test.ts: nonce present in both CSP and inline script tag,'unsafe-inline'never used, distinct nonce per panel,</script>-injection escaping still holdsnpm run typecheckandnpm run testforopenspec-ui-vscode;npm run lint(includinglint:english) workspace-widenpm run package --workspace openspec-ui-vscode— VSIX packages without erroropenspec change validate --strict fix-timeline-webview-csp-inline-script🤖 Generated with Claude Code