Commit a4294ee
committed
fix(worker): restrict CORS to configured origins; comply with npm-avoidant policy
Follow-up fixes for CI findings on PR #19:
- Security (CWE-942 / Hypatia js_wildcard_cors, critical): replace the hardcoded
wildcard Access-Control-Allow-Origin with an env-configurable allowlist
(CORS_ALLOW_ORIGIN), defaulting to the portal origin. CORS headers are now
applied centrally in fetch(); request Origin is echoed only when allowlisted.
Added 3 CORS tests (default origin, echo-allowed, never-wildcard).
- Governance (npm-avoidant policy / standards JS-RUNTIME-POLICY): stop tracking
worker/package-lock.json (now gitignored) and pin devDependencies to exact
versions for reproducibility; CI uses `npm install` instead of `npm ci`.
- Workflows: add timeout-minutes to worker-ci, worker-deploy and boj-build
(Hypatia workflow_audit).
Verified: 33/33 tests pass, eslint + prettier clean, wrangler dry-run OK,
no tracked package-lock.json.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCnxjXkN6uDj9YSANuGEgR1 parent cb0771b commit a4294ee
9 files changed
Lines changed: 97 additions & 3638 deletions
File tree
- .github/workflows
- worker
- src
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
38 | | - | |
39 | 38 | | |
| 39 | + | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
49 | | - | |
50 | 49 | | |
| 50 | + | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| |||
0 commit comments