Support CSP nonces in `workflow inspect runs --web`

Aperta
#5,192 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
express, react, typescript
Ambito
frontend, security

Direzione di ricerca

Start with startServer(port) in the @workflow/web package, which builds the Express app internally, and with the server-rendered HTML that inlines <script> tags carrying per-request router state. Check how the React renderer is called, since it accepts a nonce but none is passed. The issue leaves open whether to add a nonce option or hook to startServer or to export the Express app, so confirm the direction with a maintainer first. Done means every inline <script> gets the per-request nonce and the page runs under a nonce-based CSP without 'unsafe-inline'.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

workflow inspect runs --web serves the @workflow/web app (4.1.21) with no way to run it under a nonce-based Content-Security-Policy.

What happens

  1. workflow inspect runs --web calls startServer(port) from @workflow/web, which builds the Express app internally and does not expose it, so there is no place to add middleware.
  2. The server-rendered HTML contains inline <script> tags that carry per-request router state. Their content differs on every request, so a hash-based script-src cannot allow them.
  3. The React build supports a nonce, but none is passed to it.

Effect

A deployment that requires script-src 'self' with a nonce (for example, a security scan that fails on script-src 'unsafe-inline') has to allow 'unsafe-inline' for scripts and styles in front of the inspector.

Request

Support a CSP nonce in workflow inspect runs --web, for example:

  • an option or hook on startServer that returns a per-request nonce, which the server passes to the React renderer and adds to every inline <script> it emits; or
  • export the Express app so callers can mount their own middleware and pass the nonce themselves.

Happy to open a PR if a direction is preferred.

Lingua principale
TypeScript
Stelle
2.5k
Fork
401
Merge medio
1g 21h
PR unite (30g)
201

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel/workflow

Tutte le issue di vercel/workflow

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.