Skip to content

Commit 3f1531e

Browse files
aspiersclaude
andcommitted
docs(shared): clarify previewClientIdScriptHtml no-nonce branch
The existing docstring claimed pds-core "doesn't set a CSP on preview pages", which was misleading — pds-core's /preview/consent route does set a CSP, it just uses 'unsafe-inline' rather than a nonce. Reword so the no-nonce branch is explicitly described as for CSPs that allow inline scripts without a nonce. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 1c1ab1e commit 3f1531e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/shared/src/preview-ui.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,9 @@ const PREVIEW_CLIENT_ID_SCRIPT_BODY = `(function () {
487487
/**
488488
* Inline <script> tag that wires the preview index page. If `cspNonce` is
489489
* passed, the tag is stamped with `nonce="..."` so it passes a
490-
* `script-src 'nonce-...'` CSP; otherwise it's emitted bare (for services
491-
* like pds-core that don't set a CSP on preview pages).
490+
* `script-src 'nonce-...'` CSP. Otherwise the tag is emitted bare, which
491+
* only works for callers whose CSP permits this inline script without a
492+
* nonce (e.g. a `script-src` that still includes `'unsafe-inline'`).
492493
*/
493494
export function previewClientIdScriptHtml(cspNonce?: string): string {
494495
// escapeHtml defence-in-depth: callers currently pass a base64url

0 commit comments

Comments
 (0)