Opt-out for the module-load eval probe (strict CSP reports a violation on import)
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- developer-experience, security
Hướng nghiên cứu
Bắt đầu từ packages/typegpu/src/data/compiledIO.ts, nơi chứa probe EVAL_ALLOWED_IN_ENV chạy khi tải module. Đọc ba phương án opt-out được đề xuất trong issue và kiểm tra cách typegpu đã xử lý các tùy chọn root/init để chọn phương án phù hợp. Hoàn thành khi: import typegpu dưới script-src 'self' không tạo ra báo cáo securitypolicyviolation nào, và plain writer vẫn được dùng với cảnh báo hiện có khi eval không khả dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
packages/typegpu/src/data/compiledIO.ts probes for eval support when the module loads:
export const EVAL_ALLOWED_IN_ENV: boolean = (() => {
try {
new Function('return true');
return true;
} catch {
return false;
}
})();
Under a strict Content Security Policy without 'unsafe-eval', the try/catch keeps this from breaking anything: typegpu falls back to the plain writer, and since #2758/#2771 it warns once. But the browser still files a securitypolicyviolation (script-src, eval) the moment typegpu is imported, before any buffer is written.
Hosts that embed apps in sandboxed iframes with a strict CSP (MCP Apps / ChatGPT apps, browser extensions, enterprise pages with CSP reporting) treat any such report as a policy failure. An app that never wants compiled writers can't avoid the report today short of patching the package.
Request
An opt-out that skips the probe, so the plain writer is used without ever calling new Function. Any of these would work for us:
- a global flag read before the probe, like zod's
globalThis.__zod_globalConfig = { jitless: true }; - a lazy probe that runs only the first time a compiled writer is actually requested, plus a root or
initoption to disable compiled writers; - a build-time define (
TYPEGPU_NO_EVAL) that tree-shakes the probe.
Repro
- Serve a page with
Content-Security-Policy: script-src 'self'. - Add
document.addEventListener('securitypolicyviolation', e => console.log(e.violatedDirective, e.blockedURI)). - Import
typegpu. Onescript-src/evalviolation is logged at import, with no GPU work done.
Seen on typegpu 0.12.8. We currently carry a patch-package-style patch that hard-codes the plain writer and would drop it as soon as an opt-out exists. Thanks for TypeGPU!
- Ngôn ngữ chính
- TypeScript
- Star
- 3.3k
- Fork
- 141
- Merge trung bình
- 3 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 72
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của software-mansion/TypeGPU
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
software-mansion/TypeGPU#3219 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
texture.write(VideoFrame) uses the padded coded size instead of the visible sizeCó thể đã có người làm @RaphaelFakhri đã nhận 10 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
software-mansion/TypeGPU#3213 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
impr: Error message in examplesĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
software-mansion/TypeGPU#3008 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
software-mansion/TypeGPU#2948 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
docs: Fix camera orientation in "Monocular Light Injection" exampleCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
software-mansion/TypeGPU#2890 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của software-mansion/TypeGPU
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
CopilotKit/openmuse#215 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
b:minor bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
software-mansion/argent#1698 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
e2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
redhat-developer/rhdh-plugin-export-overlays#4624 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày