R-1303: every template names where its security notices are published (upstream:), gate upstream + decoys, checklist 1.10
gates / gates (push) Successful in 54s
gates / gates (push) Successful in 54s
This commit is contained in:
1 parent
8ddc68bad7
commit
f61800aae9
72 files changed
+459
-3
No files matched your search
@@ -38,6 +38,8 @@ Gates, in order (all must pass; **non-zero exit on any failure**):
|
||||
allow-list does not give (R-971); the box (controller >= 0.328.0) refuses on its own
|
||||
18. security-scan the SHARED scanner (felhom.eu/scripts/security_scan_gate.py) — gitleaks on the pushed commits,
|
||||
WARN-FIRST: it lists, it never refuses (R-986); no Go module here, so no govulncheck
|
||||
19. upstream static, instant, whole repo — every template image names where its security notices are
|
||||
published (`.felhom.yml` `upstream:`; SHARED rule felhom.eu/scripts/security_watch_inventory.py, R-1303)
|
||||
15. gate-decoys the decoy suite (test_gate_decoys.py) — each gate above still convicts its decoys
|
||||
(R-1115). ~3 minutes, needs PyYAML: the full run only, never --fast
|
||||
4. engine-major static, needs GIT HISTORY — no database engine pin crosses a MAJOR version
|
||||
@@ -171,6 +173,10 @@ GATES = [
|
||||
# so no tier copies it — optional mirrored every download to the second drive, unlisted sent it off-site.
|
||||
("download-binds", "check-download-binds.py", False, True, False),
|
||||
("security-scan", "check-security-scan.py", False, True, False),
|
||||
# R-1303 (2026-10-26): every template image names where its security notices are published (`.felhom.yml`
|
||||
# `upstream:`), read by the nightly security watch. The rule is SHARED (felhom.eu/scripts/security_watch_inventory.py).
|
||||
# Static, files only, so --fast: the hook and CI.
|
||||
("upstream", "check-upstream.py", False, True, False),
|
||||
# R-1115 (2026-10-17): the gates' OWN decoy suite — every gate above is red-proved against its decoys here. It
|
||||
# was not in this table, so a case that stopped convicting (a template edit removed its premise) failed for a
|
||||
# night with nobody looking. Static (a local clone, a stub docker), but ~3 minutes and it needs PyYAML, so NOT
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
"""check-upstream.py — every image of every template names where its security notices are published (R-1303).
|
||||
|
||||
The rule and its reader live in ONE place, `felhom.eu/scripts/security_watch_inventory.py` (the reuse_refs_check.py
|
||||
rule: never copied); the nightly security watch reads the same lines. A template image with no line in its
|
||||
`.felhom.yml` `upstream:` block refuses the push; a `gap:<why>` is allowed (a stated hole, listed in every weekly mail).
|
||||
If the sibling felhom.eu clone is absent this FAILS and names the path it tried — never a skip.
|
||||
|
||||
USAGE python3 scripts/check-upstream.py [--root=<catalog checkout>] (the decoy suite judges a scratch catalog)
|
||||
Exit: 0 every image has an upstream · 1 convicted · 2 inconclusive.
|
||||
Decoys: scripts/test_gate_decoys.py `upstream_cases` (COVERS "upstream").
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
SHARED = os.path.join(os.path.dirname(ROOT), "felhom.eu", "scripts", "security_watch_inventory.py")
|
||||
|
||||
if __name__ == "__main__":
|
||||
root = ROOT
|
||||
for a in sys.argv[1:]:
|
||||
if a.startswith("--root="):
|
||||
root = a.split("=", 1)[1]
|
||||
shared = os.environ.get("FELHOM_UPSTREAM_GATE", SHARED)
|
||||
if not os.path.isfile(shared):
|
||||
print("FAIL: the shared gate is MISSING beside this clone (tried %s) — a failure, never a skip" % shared)
|
||||
sys.exit(1)
|
||||
sys.exit(subprocess.call([sys.executable, shared, "--gate=catalog", root]))
|
||||
@@ -67,6 +67,7 @@ COVERS = {
|
||||
"unclean-boot-images": "the new image only in a compose COMMENT, on ANOTHER service (machine-learning), or under a COMMENTED-OUT block; a template with no block - each passes; vs the facts: the repair's service bumped with the list unchanged, the same in a steps/ file (the ladder), a block naming a service the compose does not run, a block with an empty images: list; and the genuine bump with the list updated (flow and block list) passes (R-1007, decision 236)",
|
||||
"guide-version": "ADVISORY, exit 0 always: checked_version written only in a COMMENT or only inside the English block (no guide - never read as the fact), the checked tag carried by a SIDECAR while the app's own service moved (still WARNs), an empty checked_version (hidden, named) - vs the fact: the app's image moved off the checked tag (WARN naming both versions, exit 0), and a current guide (no WARN) (2026-10-15)",
|
||||
"image-volumes": "the data path mounted only in a COMMENT, on ANOTHER service (romm-db), at the PARENT (/romm) or a CHILD (/romm/assets/x), or only as a top-level volume never mounted - each refused; a steps/ file without it refused; vs the facts: a named volume or a bind AT the path passes, an image not in the registry is not judged, no templates/ is rc 3 (R-1097)",
|
||||
"upstream": "R-1303: the upstream line only in a COMMENT, under ANOTHER key (description:), keyed by a DIFFERENT image (a typo), a `gap:` with no reason, an unknown source kind; an image added to the compose with no line - vs the facts: every image named, a gap with a reason",
|
||||
"login-kind": "login_kind written only in a COMMENT, only inside the English i18n: block, or under ANOTHER mapping (resources:) - none is the field, each passes; vs the facts: an unknown value (`magic`), a wrong case (`EMAIL`), the key twice, and no templates/ at all (rc 3, never a pass); the three known values pass (controller 0.320.0)",
|
||||
"copy-i18n": "Hungarian edited in a COMMENT/README/display_name (label, not copy) vs a real frozen string changed; an English block that is not English, is not matched to a Hungarian twin, or rewrites a credential (R-560). A retrieval promise REGISTERED in ALLOWLIST_EN passes only for its own app+path+sentence with a real reason; an entry for another app, a rewritten sentence, a stale entry or a two-word reason convicts (R-594). Also the DEGRADED mode CI actually runs — PyYAML shadowed out, freeze only (R-595). THE USER GUIDE (2026-10-15): a download-source name only in a COMMENT or in docs_url passes; vs the facts - guide strings not frozen, checked_version in the English block, an empty steps list, an FAQ entry with no answer, an unquoted version, an English guide with no Hungarian one, more English sections than Hungarian, a different step count, and a source name in either language",
|
||||
"redis-persistence": "`--appendonly yes` only in a COMMENT, or only in a steps/ file (a tested step definition, not judged on purpose) - each passes; vs the facts: AOF in string form, in a flow list, in a block list, on a valkey image - each refused naming the app; image default (no command) and `--appendonly no` pass; no templates/ is rc 3 (R-1096)",
|
||||
@@ -1676,6 +1677,52 @@ def security_scan_cases():
|
||||
shutil.rmtree(tmp, ignore_errors=True)
|
||||
|
||||
|
||||
def upstream_cases():
|
||||
"""check-upstream.py (the SHARED felhom.eu rule) reads FILES: templates/*/docker-compose.yml + .felhom.yml (R-1303)."""
|
||||
global ran
|
||||
import tempfile
|
||||
ws = tempfile.mkdtemp(prefix="catalog-upstream-")
|
||||
try:
|
||||
COMPOSE = ("services:\n demo:\n image: demo/demo:1.0\n demo-db:\n image: postgres:16-alpine\n")
|
||||
META = ('display_name: "Demo"\ndescription: "github:demo/demo"\n'
|
||||
'upstream:\n demo/demo: "github:demo/demo"\n postgres: "gap:PostgreSQL announces on postgresql.org only"\n')
|
||||
|
||||
def run(name, compose, meta, expect_rc, must=()):
|
||||
global ran
|
||||
cat = os.path.join(ws, "cat")
|
||||
shutil.rmtree(cat, ignore_errors=True)
|
||||
d = os.path.join(cat, "templates", "demo")
|
||||
os.makedirs(d)
|
||||
io.open(os.path.join(d, "docker-compose.yml"), "w", encoding="utf-8").write(compose)
|
||||
io.open(os.path.join(d, ".felhom.yml"), "w", encoding="utf-8").write(meta)
|
||||
r = sh([sys.executable, os.path.join(ROOT, "scripts", "check-upstream.py"), "--root=" + cat], ROOT)
|
||||
out = r.stdout + r.stderr
|
||||
ran += 1
|
||||
ok = r.returncode == expect_rc and all(m in out for m in must)
|
||||
print(" %s %-70s rc=%d (expected %d)" % ("ok" if ok else "XX", name, r.returncode, expect_rc))
|
||||
if not ok:
|
||||
fails.append("%s: rc=%d expected %d; missing %s\n%s" % (
|
||||
name, r.returncode, expect_rc, [m for m in must if m not in out], out[-400:]))
|
||||
|
||||
print("\n-- upstream: genuine and decoys")
|
||||
run("GENUINE: both images named, the gap has a reason", COMPOSE, META, 0, ("upstream gate OK", "1 stated gaps"))
|
||||
print("-- upstream: the facts (each MUST be refused)")
|
||||
run("FACT: the line only in a COMMENT", COMPOSE,
|
||||
META.replace(' demo/demo: "github:demo/demo"\n', ' # demo/demo: "github:demo/demo"\n'), 1, ("demo/demo", "no upstream line"))
|
||||
run("FACT: the source only under ANOTHER key (description:)", COMPOSE,
|
||||
META.replace(' demo/demo: "github:demo/demo"\n', ''), 1, ("no upstream line",))
|
||||
run("FACT: keyed by a DIFFERENT image (a typo)", COMPOSE,
|
||||
META.replace(' demo/demo:', ' demo/dmeo:'), 1, ("demo/demo", "no upstream line"))
|
||||
run("FACT: a gap with no reason", COMPOSE, META.replace("gap:PostgreSQL announces on postgresql.org only", "gap:"),
|
||||
1, ("gap without a reason",))
|
||||
run("FACT: an unknown source kind", COMPOSE, META.replace('"github:demo/demo"', '"gitlab:demo/demo"'),
|
||||
1, ("unknown source kind",))
|
||||
run("FACT: an image added to the compose with no line", COMPOSE + " cache:\n image: redis:7-alpine\n", META,
|
||||
1, ("redis", "no upstream line"))
|
||||
finally:
|
||||
shutil.rmtree(ws, ignore_errors=True)
|
||||
|
||||
|
||||
def main():
|
||||
gate = os.path.join(ROOT, "scripts", "check-engine-major.py")
|
||||
if not os.path.isfile(gate):
|
||||
@@ -2208,6 +2255,7 @@ i18n:
|
||||
onboarding_cases()
|
||||
family_gate_cases()
|
||||
mem_sum_cases()
|
||||
upstream_cases()
|
||||
db_cred_cases()
|
||||
data_key_cases()
|
||||
unclean_boot_cases()
|
||||
|
||||
Reference in new issue
Block a user