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

Abierto
#5,192 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
express, react, typescript

Línea de trabajo

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'.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
2.5k
Forks
401
Merge medio
1 d 21 h
PR fusionados (30 d)
201

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vercel/workflow

Todos los issues de vercel/workflow

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.