security_check.py 36/36 (da1325c: 20/36, the 16 failures are the findings). sec_probe.py: only S3 and S12 change. equivalence_check IDENTICAL vsda1325c(canonical SOP id in the scenario). Smoke test 27/27. pip-audit clean. Open: files_check.py (T16.2), sample_check.py and critical_reopen_check.py (T16.3) need a machine with Edge; those two tasks stay not-done until they pass.
5.9 KiB
Wave 16 — Urgent security fixes
Items: D19, D20, D21
Depends on: nothing. Independent of waves 12 to 15 (see the decision record).
Decision record: docs/waves/decisions-2026-10-02.md
Background: docs/reference/security-review-2026-10-01.md
Four tasks, in build order. All server-side. No page markup or stylesheet changes, so the 390px / 1440px screenshot rule does not apply; the browser probes that read files and SOPs are still listed for a run on a machine with Edge.
New check for this wave: tests/security_check.py. It is self-contained (its
own SQLite database, in-process, no browser), so it runs anywhere.
T16.1 — D21: session decode fails closed; PyJWT 2.15.1
- Items:
D21 - Depends on: nothing (first task)
- Blocks: T16.4
- Surface:
server/ - Files:
server/requirements.txt,server/auth.py(decode_token),tests/security_check.py(new)
Do: pin PyJWT==2.15.1. In decode_token, return None for an empty or
over-long token (over 4096 characters) and for any exception from
jwt.decode. Require the exp and sub claims.
Do not: change token contents, the cookie, or the D18 refresh.
Done when:
- the crafted-cookie request returns 401, not 500
- a valid session still works, and the D18 refresh still reissues
pip-audit -r server/requirements.txtreports no PyJWT advisory- smoke test 27/27
T16.2 — D19: uploaded files download safely
- Items:
D19 - Depends on: nothing
- Blocks: T16.4
- Surface:
server/ - Files:
server/files_http.py(new),server/app.py(get_wp_file),tests/security_check.py
Do: serve PDF and raster images inline as today. Serve every other type,
SVG included, as an attachment with Content-Security-Policy: sandbox; default-src 'none'. Send X-Content-Type-Options: nosniff from the API too
(NGINX already does; the dev server does not). Build Content-Disposition
with an ASCII fallback and an RFC 5987 filename*. Reference code:
docs/reference/architecture-review/proposals/server/files_http.py (P-6).
Do not: refuse SVG uploads (decided: accept, download only). Do not change
Cache-Control.
Done when:
- an SVG downloads as an attachment with the sandbox header
- PNG, JPEG and PDF still open inline
Plan é.pdfdownloads (was 500)- a name with CR/LF produces a valid header
tests/files_check.pypasses on a machine with Edge (CR-007 offline drawings)
T16.3 — D20: one SOP per project
- Items:
D20 - Depends on: nothing
- Blocks: T16.4
- Surface:
server/ - Files:
server/app.py(upsert_sop,latest_sop,project_summary,project_sop_team,project_qa_group),tests/security_check.py
Do: the four rules in D20. One helper picks the project's baseline SOP (canonical row if complete, else latest complete) and every baseline reader uses it.
Do not: delete or rename existing SOP rows. Do not change any response shape.
Done when:
- a
project_usercannot create a second SOP on a project (400) or postcomplete: truewhile a complete SOP exists (403) - a
project_usercan still draft and complete the first SOP of a project - a Project Admin can still change the completed SOP
- POST without an id lands on
sop__<project_id> - a rogue complete SOP made before the fix no longer drives the baseline or the QA and PM/CM recipients
tests/sample_check.pyandtests/critical_reopen_check.pypass on a machine with Edge
T16.4 — D19, D20, D21: verification
- Items:
D19,D20,D21 - Depends on: T16.1 to T16.3
- Surface: verification
- Files: this file (verification record)
Done when:
tests/security_check.pypassesdocs/reference/security-review/sec_probe.py: S3 and S12 change as expected; every other line is unchanged- the architecture review
equivalence_check.py(current branch vs wave 16) is IDENTICAL: the scenario does not use these paths, so it proves the rest of the work-package flow did not move - smoke test 27/27
- the browser probes named in T16.2 and T16.3 are listed for a run on a machine with Edge (not available in the build sandbox)
Verification record
Run 2026-10-02 in the build sandbox (Linux, Python 3.10, no browser), on branch
feat/wave-16-security at T16.3.
| Check | Result |
|---|---|
tests/security_check.py |
36/36 (D21 6, D19 14, D20 16) |
Same check against da1325c with PyJWT 2.13.0 |
20/36. The 16 failures are the findings (D21 3, D19 6, D20 7). The 20 passes are the "still works" checks plus three that already held (over-long cookie 401, non-member 404, SOP move refused by the existing completed-SOP rule) |
docs/reference/security-review/sec_probe.py, before vs after |
Exactly 4 of 27 lines change: S3 (new complete SOP 200 -> 400; baseline sop_rogue -> sop__proj_a; QA group attacker -> real group) and S12 (crafted cookie 500 -> 401). All other lines identical |
equivalence_check.py (architecture review), da1325c vs wave 16 |
IDENTICAL: 78 HTTP results, 89 audit rows, 24 notifications. The scenario's SOP id was changed from sop_eq to the canonical sop__proj_eq on both sides, because D20 refuses a non-canonical id on purpose |
server/smoketest.py |
27/27 after each of T16.1, T16.2, T16.3 |
server/seed_demo.py |
Seeds the demo project; its SOP lands on the canonical id |
pip-audit -r server/requirements.txt |
No known vulnerabilities |
Not run (no headless browser in the sandbox). These done-when items stay open until someone runs them on a machine with Edge, so T16.2 and T16.3 are not marked done yet:
- T16.2:
python tests/files_check.py(CR-007 drawings, offline cache) - T16.3:
python tests/sample_check.pyandpython tests/critical_reopen_check.py
Run them one at a time (file-map.md: chained runs exhaust the browser's ports).