English · Español
Lab 00 — Hardening pass on security/THREATS.md¶
🇪🇸 Recorre
security/THREATS.mdlínea por línea. Para cada hilo abierto: cerrarlo, aceptarlo con razón explícita, o reposicionarlo como off-ramp. Cero ambigüedad.
Objective¶
Walk every open thread in security/THREATS.md end-to-end. For each: implement the mitigation (Close), write a rationale (Accept), or move it to the off-ramp list (Punt). At the end, THREATS.md contains zero items in the OPEN state.
Setup¶
security/THREATS.mdfrom earlier phases.READING_LIST.md(will be created in lab 02 — this lab adds entries before lab 02 writes the rest).- The CI:
pip-audit,bandit,mypy --strict,pytest. Run them all green before starting.
Tasks¶
- Snapshot the current state.
Print:
- Total threats listed.
- Number in OPEN state.
- Number in MITIGATED.
- Number with no explicit state (a bug — flag and add an explicit state).
- Triage each open threat. For each open thread, in order, decide one of three:
- Close. Implement the mitigation now. Add a test that verifies it. Update the status to
MITIGATED by <test_name>with a link. - Accept with rationale. Write the rationale per
theory/03-residual-risk-and-offramps.md. Must include: (a) why the threat doesn't apply now, (b) mitigations in force, © trigger for reassessment, (d) review date. -
Punt to off-ramp. Move to
READING_LIST.mdunder the "off-ramps" section. Mark inTHREATS.mdas[PUNTED: see READING_LIST.md #N]. -
Re-run CI and the security tools:
All four must pass. If bandit or pip-audit flags new issues, decide: close or accept (with rationale). Repeat until clean.
- Verify the snapshot:
Expected:
- OPEN: 0
- MITIGATED or ACCEPTED: > 0
- All threats have an explicit state.
- Write a one-page hardening summary at
security/HARDENING_PHASE_40.md: - How many threats started open vs ended open.
- How many were closed; key closure tests.
- How many were accepted; the highest-risk accepted threat (one sentence).
- How many were punted; pointer to the off-ramp section.
Deliverables¶
- Updated
security/THREATS.mdwith zeroOPENthreats. security/HARDENING_PHASE_40.md(one page).- Tests added for any newly-closed threat in
tests/security/. - Off-ramp entries added to
READING_LIST.md.
Acceptance¶
python scripts/count_threats.pyreports 0 open threats.- Every threat has either: a
MITIGATED by <test>link, anACCEPTED with rationale + review date, or aPUNTED to READING_LIST.md #Nreference. bandit,pip-audit,mypy --strict, andpytestall pass.- The hardening summary is honest about which threats were accepted, not just which were closed.
Pitfalls¶
- Closing a threat without a test. If there's no test, you closed nothing — you wrote a comment. Every closed threat must have a test that would fail if the threat were re-introduced.
- Accepting without a trigger. "Accepted forever" is not acceptance, it's avoidance. Force yourself to write the reassessment trigger.
- Punting too aggressively. If you punt more than ~30% of open threats, you're using the off-ramp as a dumping ground. Re-examine: are any of them quick closures you skipped?
- Treating
banditandpip-auditwarnings as "not real." Some are noise (false positives on patterns). For each warning, either add a# noseccomment with a one-sentence rationale or fix it. Silent suppression is forbidden.
Stretch¶
- Add a CI step that runs
count_threats.pyand fails if any thread is in theOPENstate. Prevents future open-thread accumulation. - Add a 6-month review reminder — a markdown table at the top of
THREATS.mdwith every "accepted" entry's next review date, sortable.