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

Đang mở
#5,192 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
frontend, security

Hướng nghiên cứu

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

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
2.5k
Fork
401
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
201

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vercel/workflow

Tất cả issue của vercel/workflow

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.