Skip to content

Use 'self' instead of 'strict-dynamic' in script-src CSP (fixes blank UI in Chrome 158+) - #4126

Merged
tegan-temporal merged 1 commit into
temporalio:mainfrom
scoobyluu:fix/csp-strict-dynamic-chrome-158
Nov 6, 2026
Merged

tegan-temporal merged 1 commit into
temporalio:mainfrom
scoobyluu:fix/csp-strict-dynamic-chrome-158

Conversation

@scoobyluu

Copy link
Copy Markdown
Contributor

Description & motivation πŸ’­

Fixes #4125. In Chrome 158+ the UI loads as a blank page: the CSP meta tag blocks the inline bootstrap's import() of /_app/immutable/entry/start.*.js and app.*.js.

-      directives: { 'script-src': ['strict-dynamic'] },
+      directives: { 'script-src': ['self'] },

Why: the UI is a static build, so mode: 'auto' authorizes the inline bootstrap with a hash, not a nonce. Hashes don't propagate to import(), so under 'strict-dynamic' the entry imports are parser-inserted requests with no nonce, and CSP3 blocks them. This only worked before because the entry chunks were already in the module map via <link rel="modulepreload">, and module-map hits weren't re-checked against CSP. Chrome 158 closed that as a CSP bypass in chromium/chromium@78b1ee2 (crbug 515948871). Chrome 158 reaches stable on 2026-11-17.

With 'self', the inline bootstrap is still hash-only, and the same-origin entry and chunk imports are allowed. Adding 'self' alongside 'strict-dynamic' would not work, because browsers ignore host sources when 'strict-dynamic' is present.

Design Considerations 🎨

Security trade-off (details in #4125):

  • Unchanged: inline script, event-handler attributes, and javascript: URLs are still blocked (hash-only).
  • Tighter: trusted scripts can no longer load script from arbitrary origins.
  • Looser: an injected <script src="/…"> pointing at the same origin is allowed. The same-origin surface is only build assets. /api/v1, /render and /auth can't execute as script because middleware.Secure() sets nosniff.

A stronger long-term option is a per-request nonce injected by ui-server's index handler, keeping 'strict-dynamic'. That's a larger change, so this PR is the immediate fix.

Testing πŸ§ͺ

How was this tested πŸ‘»

  • Manual testing
  • E2E tests added
  • Unit tests added

Chrome 158.0.8127.19 (macOS arm64, headless), vite build output served statically:

build/index.html CSP Result
script-src 'strict-dynamic' 'sha256-…' (current) blank page, 2 CSP violations, Failed to fetch dynamically imported module
script-src 'self' 'sha256-…' (this PR) app boots and the router renders, 0 CSP violations

A minimal repro (hashed inline import() Β± modulepreload) is in #4125.

Not yet tested against a running Temporal backend.

Steps for others to test: πŸšΆπŸ½β€β™‚οΈπŸšΆπŸ½β€β™€οΈ

  1. pnpm build:local, then serve build/ (e.g. python3 -m http.server --directory build).
  2. Open it in Chrome 158+ and check the console: no CSP violations, and the app renders.
  3. On main, the same steps give a blank page.

Checklists

Issue(s) closed

Fixes #4125

Docs

Any docs updates needed?

No.

@scoobyluu
scoobyluu requested a review from a team as a code owner November 5, 2026 15:04
@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Temporal Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Nov 5, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

The UI is a static build, so SvelteKit's `mode: 'auto'` CSP authorizes
the inline bootstrap with a hash rather than a nonce. Hashes don't
propagate to the bootstrap's `import()` of the entry chunks, so under
`'strict-dynamic'` those imports are parser-inserted requests with no
nonce and are blocked per CSP3.

This previously worked only because the entry chunks were already in
the module map via <link rel="modulepreload">, and module-map hits
weren't re-checked against CSP. Chrome 158 closed that bypass
(chromium 78b1ee2b21, crbug.com/515948871), so the UI now loads as a
blank page in Chrome 158+.

Switching to `'self'` keeps the inline bootstrap hash-only and allows
the same-origin `/_app/immutable/*` imports.

Fixes temporalio#4125
@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
holocene Ready Ready Preview Nov 6, 2026 6:55pm UTC

Request Review

@tegan-temporal
tegan-temporal merged commit 9f017f0 into temporalio:main Nov 6, 2026
18 checks passed
tegan-temporal added a commit that referenced this pull request Nov 6, 2026
Auto-generated version bump from 2.58.0 to 2.58.1

Bump type: patch

Changes included:
- [`ae4835ed`](ae4835e) Save at most two scaling groups when editing a Version (#4086)
- [`d1b26617`](d1b2661) Fix delayed badges for time-skipped workflows (#4110)
- [`31b4ed29`](31b4ed2) update Dockerfiles (#4114)
- [`ebf166ed`](ebf166e) Move search into table container (#4103)
- [`5696caf3`](5696caf) Raise content-tertiary contrast to meet WCAG AA (#4113)
- [`120ade71`](120ade7) Implement IO TextLink (#4115)
- [`fb4cc801`](fb4cc80) Add breadcrumbs component with navigation styling (#4116)
- [`8c7378a7`](8c7378a) Match saved scaling groups to regions when editing a Version (#4118)
- [`17729104`](1772910) Fix focus on Input clear button (#4121)
- [`d1950572`](d195057) Allow Serverless Workers in only the replica region (#4119)
- [`c2b35f9d`](c2b35f9) Add filtering to table header columns (#4106)
- [`191a9447`](191a944) Limit status filter options to the statuses each table supports (#4135)
- [`9f017f05`](9f017f0) Use 'self' instead of 'strict-dynamic' in script-src CSP (#4126)

Co-authored-by: tegan-temporal <277832131+tegan-temporal@users.noreply.github.com>
vishal-seshagiri-infinitusai added a commit to vishal-seshagiri-infinitusai/helm-charts that referenced this pull request Nov 6, 2026
Chrome 158 blocks the way UI versions before 2.58.1 load their entry
scripts under their CSP, so the UI renders a blank page
(temporalio/ui#4125). The fix (temporalio/ui#4126) shipped in UI v2.58.1.
nomideusz added a commit to two-workspaces/temporal that referenced this pull request Nov 7, 2026
Fixes a blank UI in Chrome 158+ (temporalio/ui#4126).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bmorton added a commit to bmorton/temporal-operator that referenced this pull request Nov 11, 2026
…LI 1.10.0 (#251)

## Releases
| Component | Version | Matrix change | Release notes |
|---|---|---|---|
| Temporal server | 1.30.9 | added to 1.30 `patchVersions` |
https://github.com/temporalio/temporal/releases/tag/v1.30.9 |
| Temporal server | 1.31.5 | added to 1.31 `patchVersions` |
https://github.com/temporalio/temporal/releases/tag/v1.31.5 |
| Temporal server | 1.32.2 | added to 1.32 `patchVersions` |
https://github.com/temporalio/temporal/releases/tag/v1.32.2 |
| Temporal CLI | 1.10.0 | 1.32 `devServerCLIVersion` 1.9.1 β†’ 1.10.0 |
https://github.com/temporalio/cli/releases/tag/v1.10.0 |
| Temporal UI | 2.58.1 | 1.32 `uiSeries` 2.56 β†’ 2.58, `defaultUIVersion`
2.56.0 β†’ 2.58.1 | https://github.com/temporalio/ui/releases/tag/v2.58.1
|

The upgrade e2e default and the nightly upgrade matrix move to the new
patches (1.30.9 β†’ 1.31.5 β†’ 1.32.2).

## Needs a decision: the UI bump (second commit)

The UI change is its own commit so it can be dropped without touching
the rest.

- **Why bump:** UI 2.58.1 fixes a blank page in Chrome 158+
([temporalio/ui#4126](temporalio/ui#4126));
Chrome 158 reaches stable on 2026-11-17. Every UI release before 2.58.1
ships the affected `'strict-dynamic'` CSP. I checked `svelte.config.js`
at v2.34.0, v2.52.1, v2.56.0 and v2.57.0.
- **Why it might be wrong:** UI Server 2.57.0+ is built against
`go.temporal.io/api` v1.64.0, while server 1.32.x uses v1.63.5. The CLI
1.10.0 notes say the embedded dev server stays on UI 2.56.x for that
reason. That is a Go-module constraint for a single binary; the
standalone UI container talks to the frontend over gRPC, which should
tolerate the difference, but **I did not verify UI 2.58.1 against a 1.32
server**, and no e2e suite in this repo runs the UI on 1.32.
- **Not changed:** the 1.27–1.31 defaults (UI 2.31.2 – 2.52.1) have the
same Chrome 158 problem. They are left alone per the playbook; this
needs a separate decision.

## Release-note review
- **Server 1.30.9:** security fixes only. No schema or dynamic config
changes.
- **Server 1.31.5 / 1.32.2:** security fixes; 1.32.2 also has
matching/backlog fixes. Potential breaking change in both:
`ValidateWorkerDeploymentVersionComputeConfig` now requires Write access
to the namespace. The operator does not call it. No schema or dynamic
config changes.
- **Schema versions** read from `schema/postgresql/v12/version.go` and
`schema/cassandra/version.go` at each tag; all match the matrix, so no
`minSchema*` change:
  - 1.30.9: SQL 1.18, visibility 1.13, Cassandra 1.13
  - 1.31.5 and 1.32.2: SQL 1.19, visibility 1.14, Cassandra 1.13
- **CLI 1.10.0:** bundles server 1.32.2 (`go.temporal.io/server v1.32.2`
in `go.mod` at the tag, and stated in the notes). Fixes a batch of
dependency CVEs. Behaviour change for `TemporalDevServer` on 1.32: the
CLI now sets `nexusoperation.enableStandalone=true` by default. Its two
breaking changes are to `--output json` of CLI commands the operator
does not use.
- **UI 2.57.0 / 2.58.0 / 2.58.1:** UI features and fixes, Go/Node and
dependency security bumps (echo, go-jose, gomarkdown). 2.57.0 moves UI
Server to `go.temporal.io/api` v1.64.0. 2.58.1 has the Chrome 158 CSP
fix.
- **Images** confirmed on Docker Hub: `server` and `admin-tools` at
1.30.9, 1.31.5, 1.32.2; `temporal:1.10.0`; `ui:2.58.1`.

## Skipped
- **UI 2.57.0 and 2.58.0:** superseded by 2.58.1.

## Validation
- `make gen-version-matrix`: regenerated and committed.
- `make test`: passes.
- `make lint`: **not run successfully locally.** The local golangci-lint
v2.5.0 binary panics with `file requires newer Go version go1.27
(application built with go1.26)` before linting anything. Relying on the
CI `Lint` job.
- No e2e run locally.

Closes #238

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01AihTX2D5gGTiM24Q4xvbzD

---------

Signed-off-by: Brian Morton <brian@mmmhm.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
vjymisal0 pushed a commit to vjymisal0/cli that referenced this pull request Nov 12, 2026
## Related issues

temporalio/ui#4125

## What changed?

Bump UI server to
[v2.58.1](https://github.com/temporalio/ui-server/releases/tag/v2.58.1).

v2.58.1 fixes the dev server UI loading as a blank page in Chrome 158+,
which reaches stable on 2026-11-17 (temporalio/ui#4126). The UI's CSP
used `'strict-dynamic'` with a hash, and Chrome 158 now blocks the
bootstrap's `import()` of the entry chunks under that policy.

ui-server v2.58.1 requires `go.temporal.io/api` v1.64.0, which pulls in
two more changes:

- `go.temporal.io/api` v1.63.5 β†’ v1.64.0. API v1.64.0 renamed
`temporalnexus.ConvertWorkflowLinkToNexusLink` β†’
`ConvertLinkWorkflowToNexusLink`, so SDK v1.47.0 no longer compiles
against it. This breaks the `internal/temporalcli` test build.
- `go.temporal.io/sdk` v1.47.0 β†’ v1.49.0, the oldest SDK that uses the
new name. v1.49.0 also renames `StartActivityOptions.Details` β†’
`StaticDetails`, so `buildStartActivityOptions` is updated to match. The
`--static-details` flag behaves the same.

## Checklist

**Stability**
- [x] No breaking changes to commands, flags, or JSON output

## Manual tests

**Setup**
```
go build -o temporal ./cmd/temporal
./temporal --version
temporal version 0.0.0-DEV (Server 1.32.2, UI 2.58.1)
./temporal server start-dev
```

**Happy path**

The UI response carries the new CSP and still sends `nosniff`:
```
$ curl -s -D - http://localhost:8233/namespaces -o index.html | grep -i -E 'content-security|nosniff'
Content-Security-Policy: frame-src 'self';
X-Content-Type-Options: nosniff
$ grep -o "script-src 'self' 'sha256-" index.html
script-src 'self' 'sha256-
```

This is the same policy that temporalio/ui#4126 verified in Chrome 158.
I haven't loaded this CLI build in a Chrome 158 browser myself.

**Tests**
- `make test` passes (`cliext` and `go test ./...`).
- `go vet ./...` and `gofmt -l` report the same pre-existing findings as
`main`. None are new.

This branch was successfully deployed

1 active deployment
Preview β€” 42054a0f Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI loads blank in Chrome 158+: script-src 'strict-dynamic' blocks entry import() (hash-mode CSP)

4 participants