D39 = B: the security-fix lane — a security_fix ladder step (box walk required, bench optional, CVE/GHSA notice), its gates + 8 decoys, the writer (--write-ladder --security), the box venue (box_walk.py --security, drill-mirror refresh); two stale tests fixed
gates / gates (push) Successful in 58s

09 §3 decision 255, R-1239. Proven on 9202 (drill catalog) — felhom.eu audits/security-lane-2026-10-23/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qRErfCoiTkvDK9N5XHbzb
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-10-23 13:08:51 +02:00
1 parent cde26abc02
commit 3898593594
12 files changed
+755 -36

No files matched your search

+111 -3
View File
@@ -40,6 +40,22 @@ AN ENTRY (all keys required unless marked):
the previous entry's `digest`. Written by `upgrade-test.py --write-ladder` from a
`--retest` verdict, never by hand.
A SECURITY-FIX STEP (`09` §3 decision 255, D39 = B, 2026-10-23): `"verdict": "security_fix"` — an urgent upstream
fix that skipped the bench. The night leg takes it like a proven step (controller >= 0.341.0; an older controller
skips it at night as `not_proven` and a person's press still takes it). Beyond the keys above it needs:
security {"ids": ["CVE-YYYY-NNNN…" | "GHSA-xxxx-xxxx-xxxx", …], "advisory": "https://…",
"fixed_in": "<the first fixed upstream version, as the advisory states it>"} — the public
notice IS the authority (no operator word per incident)
box_evidence required: the box walk (`box_walk.py --security`) on 9202, through the product's Update
seed "read_back" (a box fixture seeded and read it back after the update) | "none" (the app has
no box fixture — said, never hidden)
memory_peak_pct from the BOX soak; `memory_basis` names the venue ("box_soak")
evidence the bench record, or null when no bench ran. A bench given must be proven: `bench_verdict`
"proven" and `harness_version` >= 2 ride with it; with no bench both are null
It may NOT carry `backfilled`, `digest_from` (a same-tag fix is decision 52's lane), `engine_conversion`, nor cross
a database engine MAJOR (the judgement is check-engine-major.py's own `engine_of`/`major_of`, imported, not copied).
Written only by `upgrade-test.py --write-ladder --security`.
STEP DEFINITIONS (`09` §6.4 part 5, controller v0.268.0): every entry but the NEWEST carries its own
complete compose file at `templates/<app>/steps/<step_key(to)>.yml` — the box climbs one step at a time
and pins exactly that file; the newest step's definition is the template's `docker-compose.yml`. The box's
@@ -50,7 +66,9 @@ SAME way by the controller (`stacks.StepKey`, pinned by TestLadder_StepKeyMatche
Every path that reads or writes the format is here, so the gate and the writer cannot disagree.
"""
import hashlib
import importlib.util
import json
import os
import re
LADDER_KEY_RE = re.compile(r"^update_ladder:\s*$")
@@ -60,10 +78,86 @@ IMAGE_RE = re.compile(r"^\s+image:\s*[\"']?([^\s\"'#]+)")
DIGEST_RE = re.compile(r"^sha256:[0-9a-f]{64}$")
TS_RE = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$")
DATE_RE = re.compile(r"^\d{4}-\d{2}-\d{2}$")
VERDICTS = ("proven", "unrecorded")
VERDICTS = ("proven", "unrecorded", "security_fix")
SECURITY_FIX = "security_fix"
SECURITY_ID_RE = re.compile(r"^(CVE-\d{4}-\d{4,}|GHSA(-[23456789cfghjmpqrvwx]{4}){3})$")
SEEDS = ("read_back", "none")
MEMORY_TIGHT_PCT = 80.0
def _engine_major_module():
"""check-engine-major.py, loaded by path (its name has a hyphen) — the ONE judgement of what a database engine is
and what its major is. Reused, never copied (D39 = B, §3.2 rule 2)."""
p = os.path.join(os.path.dirname(os.path.abspath(__file__)), "check-engine-major.py")
spec = importlib.util.spec_from_file_location("check_engine_major", p)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
return mod
def engine_majors_crossed(frm, to):
"""[(service, engine, major_from, major_to), …] — every database engine service whose MAJOR differs between
`frm` and `to`. A major nobody can read is reported with None (a conviction for a security step, never a pass)."""
em = _engine_major_module()
out = []
for svc, ref in sorted((to or {}).items()):
a, b = em.engine_of((frm or {}).get(svc, "")), em.engine_of(ref)
if not b or not a:
continue
ma, mb = em.major_of(a[1]), em.major_of(b[1])
if ma is None or mb is None or ma != mb:
out.append((svc, b[0], ma, mb))
return out
def check_security(e):
"""Problems with a security_fix entry's own fields (D39 = B). Called by check_entry."""
p = []
sec = e.get("security")
if not isinstance(sec, dict):
return ["a security_fix step needs a security block {ids, advisory, fixed_in} — the public notice is its authority"]
ids = sec.get("ids")
if not (isinstance(ids, list) and ids):
p.append("security.ids must list at least one CVE or GHSA id")
else:
bad = [i for i in ids if not (isinstance(i, str) and SECURITY_ID_RE.match(i))]
if bad:
p.append("security.ids %s are not CVE-YYYY-NNNN or GHSA-xxxx-xxxx-xxxx ids" % bad)
adv = sec.get("advisory")
if not (isinstance(adv, str) and re.match(r"^https://[^\s/]+\.[^\s]+$", adv)):
p.append("security.advisory must be the notice's https:// address (got %r)" % (adv,))
if not (isinstance(sec.get("fixed_in"), str) and sec["fixed_in"].strip()):
p.append("security.fixed_in must name the first fixed upstream version")
if not (isinstance(e.get("box_evidence"), str) and e["box_evidence"].strip()):
p.append("a security_fix step must cite its box walk: box_evidence is missing")
if e.get("seed") not in SEEDS:
p.append("a security_fix step must say what was read back: seed is %r, not one of %s" % (e.get("seed"), "/".join(SEEDS)))
if not (isinstance(e.get("memory_basis"), str) and e["memory_basis"].startswith("box")):
p.append("a security_fix step's memory_peak_pct comes from the box soak: memory_basis must name it (box_…)")
ev = e.get("evidence")
if ev is None:
if e.get("bench_verdict") is not None or e.get("harness_version") is not None:
p.append("a security_fix step with no bench evidence carries no bench_verdict or harness_version")
elif not (isinstance(ev, str) and ev.strip()):
p.append("security_fix evidence is the bench record's path, or null when no bench ran")
else:
if e.get("bench_verdict") != "proven":
p.append("a security_fix step that cites a bench run needs that run PROVEN (bench_verdict %r) — a failed "
"bench is evidence against the step, never for it" % (e.get("bench_verdict"),))
if not isinstance(e.get("harness_version"), int) or e["harness_version"] < 2:
p.append("a security_fix step that cites a bench run needs its harness_version >= 2 (the memory watch)")
for k, why in (("backfilled", "a backfill cites an old record; a security fix is a new test"),
("digest_from", "a same-tag fix is a decision-52 re-test, not a security_fix step"),
("engine_conversion", "a security_fix step may not convert a database")):
if e.get(k) is not None:
p.append("a security_fix step may not carry %s (%s)" % (k, why))
if e.get("from") == e.get("to"):
p.append("a security_fix step must move an image (from == to is a decision-52 re-test)")
for svc, eng, a, b in engine_majors_crossed(e.get("from"), e.get("to")):
p.append("a security_fix step may not cross a database engine major: %s (%s) %s -> %s" % (svc, eng, a, b))
return p
def images_in(compose_text):
"""{service: image} — per service, from that service's OWN `image:` line (the same reading
check-engine-major.py and check-catalog-since.py make)."""
@@ -145,7 +239,21 @@ def check_entry(e):
for svc in e["digest"]:
if svc not in e["to"]:
p.append("digest names a service %r that `to` does not" % svc)
if e["from"] == e["to"] and v == "proven" and backfilled is None: # a RE-TEST (decision 52)
if v == SECURITY_FIX:
p.extend(check_security(e))
if not (isinstance(e["tested_at"], str) and TS_RE.match(e["tested_at"])):
p.append("a security_fix step needs tested_at (the box walk's time) as an RFC 3339 time")
peak = e["memory_peak_pct"]
if not isinstance(peak, (int, float)) or isinstance(peak, bool):
p.append("a security_fix step needs memory_peak_pct from the box soak")
elif isinstance(e["marks"], dict) and bool(e["marks"].get("memory_tight")) != (peak > MEMORY_TIGHT_PCT):
p.append("marks.memory_tight=%s disagrees with memory_peak_pct=%s (tight above %d%%)"
% (e["marks"].get("memory_tight"), peak, MEMORY_TIGHT_PCT))
elif e.get("security") is not None or e.get("seed") is not None:
p.append("security / seed belong only to a security_fix step")
if v == SECURITY_FIX:
pass # digest_from is judged by check_security, with its own sentence
elif e["from"] == e["to"] and v == "proven" and backfilled is None: # a RE-TEST (decision 52)
df = e.get("digest_from")
if not isinstance(df, dict) or set(df) != set(e["to"]) or not all(isinstance(x, str) and DIGEST_RE.match(x) for x in df.values()):
p.append("a re-test (from == to) needs digest_from: {service: sha256} for every service — the digest it was tested FROM")
@@ -187,7 +295,7 @@ def check_entry(e):
def entry_line(e):
"""The one line the writer emits for an entry — key order fixed so diffs stay readable."""
order = ["from", "to", "digest", "verdict", "tested_at", "harness_version", "evidence",
"box_evidence", "memory_peak_pct", "marks", "backfilled", "note"]
"box_evidence", "memory_peak_pct", "marks", "backfilled", "security", "seed", "note"]
ordered = {k: e[k] for k in order if k in e}
for k in e:
if k not in ordered: