diff --git a/openspec/changes/archive/2026-08-26-fix-timeline-webview-csp-inline-script/.openspec.yaml b/openspec/changes/archive/2026-08-26-fix-timeline-webview-csp-inline-script/.openspec.yaml new file mode 100644 index 0000000..9bb4379 --- /dev/null +++ b/openspec/changes/archive/2026-08-26-fix-timeline-webview-csp-inline-script/.openspec.yaml @@ -0,0 +1,3 @@ +schema: spec-driven +created: 2026-08-26 +skip_specs: true diff --git a/openspec/changes/archive/2026-08-26-fix-timeline-webview-csp-inline-script/proposal.md b/openspec/changes/archive/2026-08-26-fix-timeline-webview-csp-inline-script/proposal.md new file mode 100644 index 0000000..4eab381 --- /dev/null +++ b/openspec/changes/archive/2026-08-26-fix-timeline-webview-csp-inline-script/proposal.md @@ -0,0 +1,52 @@ +## Why + +The user reported "No timeline data" in every timeline webview (both +the single-change command from `2026-08-26-add-change-timeline-view` +and the comparison command from +`2026-08-26-add-multi-change-timeline-view`) after installing the real +extension. Root cause: `TimelineWebviewPanel`'s CSP +(`script-src ${webview.cspSource}`) does not include `'unsafe-inline'` +or a nonce, so the browser silently blocks the inline +`` tag used to +embed the already-fetched data — the external ``-injection + escaping still holds. +- No spec text change: `openspec/specs/vscode-extension/spec.md`'s + existing Requirements (added by the two prior changes) already + describe the intended behavior correctly — the code just failed to + satisfy it. `.openspec.yaml` sets `skip_specs: true`. + +## Capabilities + +### Modified Capabilities + +(none in the specified-behavior sense — restores already-specified +behavior; `.openspec.yaml` sets `skip_specs: true`) + +## Impact + +- `packages/extension/src/webview/timeline-panel.ts` +- `packages/extension/src/webview/timeline-panel.test.ts` (new) +- `.changeset/*.md` (new changeset file) diff --git a/openspec/changes/archive/2026-08-26-fix-timeline-webview-csp-inline-script/tasks.md b/openspec/changes/archive/2026-08-26-fix-timeline-webview-csp-inline-script/tasks.md new file mode 100644 index 0000000..f8d8b91 --- /dev/null +++ b/openspec/changes/archive/2026-08-26-fix-timeline-webview-csp-inline-script/tasks.md @@ -0,0 +1,26 @@ +## 1. Fix + +- [x] 1.1 Add a per-panel nonce in `timeline-panel.ts`'s `getHtml()`, + included in the CSP's `script-src` and on the inline data-injection + ` sequence so it cannot close the script tag early", () => { + const panel = createPanelFixture(); + const timelinePanel = createTimelinePanel(); + + timelinePanel.show("my-change", { changeName: "my-change", proposal: "" } as never); + + // Escaping every literal `<` to `\u003c` is sufficient on its own — + // the HTML tokenizer's script-end-tag detection requires a real `<` + // character, so the raw substring `` sequence (e.g. inside // markdown content) from closing the script tag early. const payloadJson = JSON.stringify(payload).replaceAll("<", "\\u003c"); @@ -59,7 +67,7 @@ export class TimelineWebviewPanel {
- +