Title: [Feature]: CSP-safe worker execution mode (remove the mandatory `'unsafe-eval'`) · Issue #134 · bQuery/bQuery · GitHub
Open Graph Title: [Feature]: CSP-safe worker execution mode (remove the mandatory `'unsafe-eval'`) · Issue #134 · bQuery/bQuery
X Title: [Feature]: CSP-safe worker execution mode (remove the mandatory `'unsafe-eval'`) · Issue #134 · bQuery/bQuery
Description: Pre-flight checklist I searched existing issues and did not find a duplicate request. I explained the problem or use case, not just the desired API. Problem or use case concurrency currently revives worker bodies with new Function(...), ...
Open Graph Description: Pre-flight checklist I searched existing issues and did not find a duplicate request. I explained the problem or use case, not just the desired API. Problem or use case concurrency currently revive...
X Description: Pre-flight checklist I searched existing issues and did not find a duplicate request. I explained the problem or use case, not just the desired API. Problem or use case concurrency currently revive...
Opengraph URL: https://github.com/bQuery/bQuery/issues/134
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Feature]: CSP-safe worker execution mode (remove the mandatory `'unsafe-eval'`)","articleBody":"**Pre-flight checklist**\n- [x] I searched existing issues and did not find a duplicate request.\n- [x] I explained the problem or use case, not just the desired API.\n\n**Problem or use case**\n`concurrency` currently revives worker bodies with `new Function(...)`, which forces applications to allow `'unsafe-eval'` in their Content-Security-Policy (plus `worker-src blob:`). This is a non-starter for security-conscious deployments and is self-contradictory in a framework that ships a security module and markets \"secure by default.\" It is the primary blocker to `concurrency` leaving Experimental (#133).\n\n**Proposed solution**\nProvide a default execution mode that does not require `'unsafe-eval'` — for example, dispatching to pre-registered module workers addressed by URL (static `Worker(new URL(...))`) and passing only serializable payloads, rather than serializing function bodies for eval-based revival. Keep the current dynamic mode available as an explicit opt-in for users who accept the CSP trade-off, but make the safe mode the documented default so the out-of-the-box posture is CSP-clean.\n\n**Possible API or UX shape**\n```ts\nimport { createPool, defineWorker } from \"@bquery/bquery/concurrency\";\n\n// Registered module worker — no eval, CSP-clean.\nconst heavy = defineWorker(new URL(\"./heavy.worker.ts\", import.meta.url));\n\nconst pool = createPool({ mode: \"module\" }); // \"module\" (default) | \"dynamic\" (opt-in, needs unsafe-eval)\nconst result = await pool.run(heavy, payload);\n```\n\n**Alternatives considered**\nDocumenting the CSP requirement and leaving it as-is — unacceptable for a security-first framework and an adoption blocker. Dropping dynamic function workers entirely — too disruptive for existing users; keeping them as an explicit opt-in preserves flexibility while fixing the default.\n\n**Relevant area**\n`concurrency`\n\n**Additional context**\nAlso relevant to `security`. `createSharedBuffer()`'s `crossOriginIsolated` requirement is inherent to `SharedArrayBuffer` and can stay documented as-is; this ticket is specifically about removing the *eval* requirement, which is bQuery's own implementation choice rather than a platform constraint.\n","author":{"url":"https://github.com/JosunLP","@type":"Person","name":"JosunLP"},"datePublished":"2026-06-26T21:25:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/134/bQuery/issues/134"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e03f91a3-aa29-26ad-cb94-97f62a3694be |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D828:9E060:5BD407:837EE8:6A4E3543 |
| html-safe-nonce | 98f21e802646bc6b799f99fcae612877a9ce6ddb19c733bbaf142fb484550b02 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODI4OjlFMDYwOjVCRDQwNzo4MzdFRTg6NkE0RTM1NDMiLCJ2aXNpdG9yX2lkIjoiNzYzOTkzNDk2OTQ2OTM1MTIzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a8b83bac32c21f806b6a7e5f2110bbe5ae28622c8a42b5ee0ed433c58f19facc |
| hovercard-subject-tag | issue:4755237296 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bQuery/bQuery/134/issue_layout |
| twitter:image | https://opengraph.githubassets.com/aca6687c3d1f073604c6254e1035017f9a49df64df8709aecd76fc8e4ce84cb6/bQuery/bQuery/issues/134 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/aca6687c3d1f073604c6254e1035017f9a49df64df8709aecd76fc8e4ce84cb6/bQuery/bQuery/issues/134 |
| og:image:alt | Pre-flight checklist I searched existing issues and did not find a duplicate request. I explained the problem or use case, not just the desired API. Problem or use case concurrency currently revive... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JosunLP |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/bQuery/bQuery git https://github.com/bQuery/bQuery.git |
| octolytics-dimension-user_id | 256381806 |
| octolytics-dimension-user_login | bQuery |
| octolytics-dimension-repository_id | 1139284244 |
| octolytics-dimension-repository_nwo | bQuery/bQuery |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1139284244 |
| octolytics-dimension-repository_network_root_nwo | bQuery/bQuery |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 42a6d378d7587a44c93aca255096cd66b7c8eb2d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width