Files
felhom.eu/scripts/manifest_bearer_gate.py
T
admin 970616b72b
gates / gates (push) Failing after 11m41s
New apps 2026-10-10: Grocy and LubeLogger on the website; Monica stopped
The catalogue side is app-catalog-felhom.eu b7f0f7c. Here: the evidence, the
website, the register and the operator's view.

Website
- Two cards in the Otthon & Eletmod / Home & Lifestyle section of BOTH apps
  pages, with assets: grocy-logo.svg is grocy's own icon with its single fill
  made white like the other logos, lubelogger-logo.png is the app's own icon
  with its dark background dropped and the mark made white (the rule
  SparkyFitness's PNG follows), and six screenshots of each app's own UI with a
  household's own data, taken headless on the bench from the published template.
- The app count moved 56 -> 58 in 15 places per language set, both languages,
  and the open-source tile 49 -> 51. Checked by asking the same patterns for the
  new number afterwards. marketing/facebook/COPY.md still says 56 and is NOT
  changed: the post it carries is already scheduled.

Evidence
- documentation/audits/new-apps-2026-10-10/ — FIT.md (checklist group 0 for all
  three, with the Hungarian-UI column), the bench and box transcripts, the
  memory samples, the screenshots and the gate runs.

Register: 137 -> 139 rows, 2 opened, 0 closed.
- R-926 after a remove-keeping-backups and restore, nobody has checked what the
  app page shows for an after_install app's generated password. Measured here:
  LubeLogger is safe (its login is derived from the environment at every start,
  the new password signs in, the data is back); grocy's install password still
  signs in from the restored database but the deployed environment no longer
  carries ADMIN_PASSWORD at all. Seven apps are in the class.
- R-927 Monica, stopped at checklist 0.2 with the measurements, waiting on the
  operator.

Gate scripts: the same console trap in nineteen of them and in repo_gates.py
itself, where it ABORTED THE WHOLE RUNNER at the first gate — printing a
non-ASCII character on this workstation's cp1250 console raised
UnicodeEncodeError before the gate had decided anything, and reuse_refs_check.py
died while printing a NOTE. All now reconfigure their own streams. Red-proof
that the remaining script-test failures are not mine: test_due_checks_gate.py
fails the same 5 of 42 with the change reverted.
2026-10-10 12:34:05 +02:00

74 lines
3.7 KiB
Python

# -*- coding: utf-8 -*-
"""Manifest bearer-literal gate (v0.53.0, part of the hub bearer de-git) — no bearer-shaped
literal (64 hex chars, the `openssl rand -hex 32` shape every felhom bearer/API key uses) may
appear ANYWHERE in manifests/, comments included. Secrets ride out-of-band `kubectl create
secret` + secretKeyRef (documentation/runbooks/secrets.md); the manifests carry only
placeholders. The other known committed secrets in felhom.secret.yaml (passwords, non-hex
shapes) are a tracked backlog item (secrets.md) and are NOT matched by this gate — extend the
patterns when they are de-gitted.
Run from the repo root: python scripts/manifest_bearer_gate.py
Exit 1 on any hit.
(Named "bearer", not "secret": the repo .gitignore's `*secret*` pattern — which guards real
secret files — would silently un-track a gate with "secret" in its filename.)
"""
import io, os, re, sys
# A gate's own console must not decide its verdict. These scripts quote back Hungarian copy, file
# paths and arrow characters; a Windows console here is cp1250, and printing one of them raised
# UnicodeEncodeError *before the gate had decided anything* — reuse_refs_check.py died while printing
# a NOTE, which the runner then reported as a failure (2026-10-10). Same trap class as
# poster_facts_gate.py's, which was found by its own red-proof.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(encoding="utf-8", errors="replace")
except (AttributeError, ValueError, OSError): # pragma: no cover - old Python, or a pipe
pass
ROOT = "manifests"
# 64 hex chars with no hex/word neighbors (so longer blobs and sha256-of-file hexes embedded in
# longer strings still match at 64+, but ordinary short ids never do).
BEARER = re.compile(r"(?<![0-9a-fA-F])[0-9a-fA-F]{64}(?![0-9a-fA-F])")
# The felhom.secret.yaml carve-out is GONE (2026-10-09, R-925). That file committed the Gitea admin
# password, the umami APP_SECRET and more, into a repo gitea.dooplex.hu serves to anyone on the
# internet with no login. Every value was rotated and the file was removed from git; `.gitignore`'s
# `*secret*` rule applies to it now that it is no longer tracked. The carve-out's own comment said
# to remove it when the file was cleaned, so this is that removal — and nothing may be added back
# here: an exemption is how the last one stayed visible for three months and changed nothing.
KNOWN_BACKLOG = set()
def main():
total = 0
# AT ANY DEPTH. Was os.listdir(ROOT), one level only — measured 2026-09-01 to miss a
# bearer-shaped literal in manifests/overlays/ (R-421). There are no subdirectories today; an
# overlays/ or base/ directory is an ordinary thing to add, and the gate would have stayed green.
paths = []
for dirpath, _dirs, names in os.walk(ROOT):
for fn in sorted(names):
if fn.endswith((".yaml", ".yml")):
paths.append(os.path.join(dirpath, fn))
for path in sorted(paths):
fn = os.path.basename(path)
for lineno, line in enumerate(io.open(path, encoding="utf-8", errors="replace"), 1):
for m in BEARER.finditer(line):
masked = m.group(0)[:8] + "..." + m.group(0)[-4:]
if fn in KNOWN_BACKLOG:
print("%s:%d KNOWN-BACKLOG committed secret %s (secrets.md de-git backlog; not this gate's failure)"
% (path, lineno, masked))
continue
total += 1
print("%s:%d bearer-shaped literal %s" % (path, lineno, masked))
if total:
print("MANIFEST BEARER GATE FAILED: %d bearer-shaped literal(s) in manifests/" % total)
sys.exit(1)
print("manifest bearer gate OK - no bearer-shaped literals in manifests/")
if __name__ == "__main__":
main()