R-1303: every template names where its security notices are published (upstream:), gate upstream + decoys, checklist 1.10
gates / gates (push) Successful in 54s

This commit is contained in:
admin committed 2026-10-26 23:23:12 +01:00
1 parent 8ddc68bad7
commit f61800aae9
72 files changed
+459 -3

No files matched your search

+48
View File
@@ -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()