R-1019: the download folders of qBittorrent, Transmission (+ watch), NZBGet, SABnzbd and MeTube are excluded from every backup tier; gate download-binds with decoys
gates / gates (push) Successful in 38s
gates / gates (push) Successful in 38s
This commit is contained in:
1 parent
5e37aa6e2f
commit
c50adfc641
11 files changed
+248
-14
No files matched your search
@@ -1,3 +1,19 @@
|
||||
## 2026-10-20 — download folders out of the backups (R-1019): five download clients `excluded`; gate `download-binds`
|
||||
|
||||
- **qBittorrent** `media/torrents`, **Transmission** `media/transmission` and its `media/transmission/watch`, **NZBGet**
|
||||
`media/nzbget`, **SABnzbd** `media/usenet`, **MeTube** `media/metube`: `class: optional` → `excluded` (felhom.eu
|
||||
`architecture/15-media-library.md` §7). Before: on a box with a second drive every download was mirrored there each
|
||||
night (Tier 2 = mandatory + optional). Measured with the controller's own classifier (main `93fb251`) over the
|
||||
templates: before, each of the five copied its download folder to the secondary tier; after, 0 paths on every tier
|
||||
(felhom.eu `audits/night2-2026-10-20/P3/classifier-before-after.txt`). The apps' own state stays in their
|
||||
`important` volumes. No image change, so no `catalog_since` move. The brief named qBittorrent and Transmission; the
|
||||
gate's rule (a download folder is never optional or mandatory) covers all five downloaders, so the other three moved
|
||||
too — said in the report.
|
||||
- **New gate `download-binds`** (`scripts/check-download-binds.py`, `--fast`): a `${USERDATA_PATH}/<folder>` bind at the
|
||||
container target `/downloads` or `/watch` must be declared `excluded` in `.felhom.yml` `backup.userdata`; optional,
|
||||
mandatory or UNLISTED is refused. Standard library only (catalog CI has no PyYAML). Decoys (11 cases) in
|
||||
`test_gate_decoys.py`. Before the fix it refused the live catalog six times; after it, clean.
|
||||
|
||||
## 2026-10-19 — `box_walk.py` reads scratch guest 9202's address from the guest (DHCP); no template change
|
||||
|
||||
- 9202 takes its address by DHCP (.114 until 2026-10-19, then .121), and the walk's row still named .114, so a walk
|
||||
|
||||
@@ -1,9 +1,40 @@
|
||||
# REPORT — catalog, 2026-10-19 night (tooling only, no template change)
|
||||
# REPORT — download folders out of the backups (R-1019), 2026-10-20
|
||||
|
||||
- **The security-scan gate (R-986):** `catalog_gates.py` runs the SHARED `felhom.eu/scripts/security_scan_gate.py`
|
||||
through `scripts/check-security-scan.py` (fast set: hook and CI; it FAILS if the sibling is missing). No Go module
|
||||
here, so gitleaks on the pushed commits only, warn-first. CI now clones the felhom.eu sibling and fetches the pinned
|
||||
gitleaks. `.security-accepted`: nothing (today's tree: 0 hits). Decoys: 3 cases in `test_gate_decoys.py` (the shared
|
||||
8, the wrapper on this tree, the wrapper with the shared gate missing); the full decoy suite: 292 cases OK.
|
||||
- **`box_walk.py` reads scratch guest 9202's address from the guest** (it is DHCP: .114 until 2026-10-19, then .121).
|
||||
- CI: 2111 success (`87f5588`).
|
||||
**What:** the night brief part 2 (run by day on 2026-10-20), Part 3. Architecture: felhom.eu
|
||||
`documentation/architecture/15-media-library.md` §7 (the per-drive media bind is `excluded`).
|
||||
|
||||
**Change:** five download clients declare their download folder `class: excluded` (was `optional`): qBittorrent
|
||||
`media/torrents`, Transmission `media/transmission` + `media/transmission/watch`, NZBGet `media/nzbget`, SABnzbd
|
||||
`media/usenet`, MeTube `media/metube`. No image change.
|
||||
|
||||
**Every media-stack bind and its class (after):**
|
||||
|
||||
| App | Bind (userdata) | Class | Tier 2 (second drive) | Off-site |
|
||||
|---|---|---|---|---|
|
||||
| qBittorrent | media/torrents (at /downloads and its own path) | excluded | — | — |
|
||||
| Transmission | media/transmission (/downloads), media/transmission/watch (/watch) | excluded, excluded | — | — |
|
||||
| NZBGet | media/nzbget (/downloads) | excluded | — | — |
|
||||
| SABnzbd | media/usenet (/downloads) | excluded | — | — |
|
||||
| MeTube | media/metube (/downloads) | excluded | — | — |
|
||||
| Sonarr | media (rw, same path) | excluded | — | — |
|
||||
| Radarr | media (rw, same path) | excluded | — | — |
|
||||
| Prowlarr | no userdata bind (state in its volume) | — | — | — |
|
||||
| Jellyfin / Plex / Emby | media (:ro) | excluded | — | — |
|
||||
|
||||
Each app's own state (settings, queue, resume data) stays in its `important` named volume.
|
||||
|
||||
**Proof (no test box has these apps):** the controller's own classifier (main `93fb251`: `LoadMetadata` →
|
||||
`ParseComposeClassifiableBinds` → `ClassifyBinds` → `ComputeCaptureSet`) over the templates, before and after —
|
||||
before, each of the five downloaders copied its folder to the secondary tier; after, 0 paths on every tier. Evidence:
|
||||
felhom.eu `documentation/audits/night2-2026-10-20/P3/classifier-before-after.txt`. The probe was a temporary test,
|
||||
not committed.
|
||||
|
||||
**Gate:** `scripts/check-download-binds.py` (`download-binds`, `--fast`): a `${USERDATA_PATH}/<folder>` bind at the
|
||||
container target `/downloads` or `/watch` must be `excluded`; optional, mandatory or unlisted is refused. Before the fix
|
||||
it refused the live catalog 6 times; after, clean. Decoys: 11 cases in `test_gate_decoys.py` (comment-only target,
|
||||
comment-only class, steps/-only bind pass; optional, mandatory, unlisted, a /watch child, a target below /downloads
|
||||
refused; no download bind / no templates rc 3). `catalog_gates.py --fast` green.
|
||||
|
||||
**Scope note:** the brief named qBittorrent and Transmission. NZBGet, SABnzbd and MeTube carry the same reason in their
|
||||
own comment („large, and fetchable again"), and the brief's gate rule covers every download folder, so they moved too.
|
||||
If MeTube's videos should keep a copy on the second drive, it is one line back to `optional` plus a gate exception.
|
||||
@@ -48,6 +48,7 @@ Templates are config; the few script helpers other scripts must REUSE, never re-
|
||||
' >&3 && head -1 <&3 | grep -q 200"]` — the fifth family, added 2026-10-10. `ghcr.io/hargata/lubelogger` carries **no curl, no wget, no nc, no python and no node** (measured), so none of the four families above exists in it; it does carry bash, and bash's `/dev/tcp` speaks TCP without any helper binary. **Measured in BOTH directions before it was written down**: rc 0 against the running app (`HTTP/1.1 200 OK`), rc 1 against a dead port. TRAPS: it needs **bash**, not `sh` — Debian's `sh` is dash and has no `/dev/tcp`, so check `command -v bash` in the image first; `head -1 … | grep -q` is a pipeline, so the FIRST command's failure is invisible — the `&&` chain in front of it is what makes a refused connection fail the check, and that is why the connect is not inside the pipeline. Prefer a real HTTP line (`200`) over a bare TCP connect: a port that is open while the app refuses every request is the uptime-kuma shape (R-613). |
|
||||
| Docker healthcheck — DB/Redis sidecars | `templates/paperless-ngx/docker-compose.yml` (~L107, L129) | postgres: `pg_isready -U <user> -d <db>`; mariadb: `healthcheck.sh --connect --innodb_initialized`; redis: `redis-cli ping`. App container gets `depends_on: <db>: condition: service_healthy`. |
|
||||
| MariaDB sidecar — `MARIADB_AUTO_UPGRADE=1` | `templates/bookstack/docker-compose.yml` (`bookstack-db` `environment:`), also kimai/nextcloud/romm | **Every `mariadb:` sidecar carries `MARIADB_AUTO_UPGRADE=1`** (operator ruling 2026-09-13, `felhom.eu/documentation/audits/SPIKE-r459-mariadb-upgrade-2026-09-06.md`). Without it a major engine move starts on the old datadir, logs that the conversion was **skipped**, and says `Check required!` on every start forever (R-459); with it the engine converts in ~7 s and backs its system tables up first (`system_mysql_backup_<ver>.sql.zst` left in the datadir). `MARIADB_DISABLE_UPGRADE_BACKUP` stays UNSET — that backup is the precaution. **Not an image change, so `catalog_since` does not move.** TRAP (R-464): the entrypoint prints `MariaDB upgrade not required` on an UNSUPPORTED downgrade too — ask `mariadb-upgrade --check-if-upgrade-is-needed` (exit 0 = needed, 1 = not), never the log line. PostgreSQL sidecars have NO equivalent (the image runs no `pg_upgrade`, R-463). **Until Slice 4 (R-448) ships, no template may move a `mariadb:`/`postgres:` pin across a MAJOR** — `scripts/check-engine-major.py` refuses it in the pre-push hook. |
|
||||
| Download folder — `class: excluded` (R-1019, 2026-10-20) | `templates/qbittorrent/.felhom.yml` `backup.userdata` (also transmission + its `watch`, nzbget, sabnzbd, metube) | **A download client's download folder is declared `excluded`** (felhom.eu `architecture/15-media-library.md` §7): no tier copies it. `optional` mirrored every download to the household's second drive each night (Tier 2 = mandatory + optional) and could fill it; UNLISTED is worse — the controller classes an unlisted writable `${…_PATH}` bind MANDATORY, so it went off-site too. The folder is found by its FACT, the container target `/downloads` or `/watch`; gate `scripts/check-download-binds.py` (`--fast`, decoys in `test_gate_decoys.py`). The app's own state (settings, queue, resume data) stays in its `important` volume. |
|
||||
| Memory convention | `templates/paperless-ngx/docker-compose.yml` (~L71) + `.felhom.yml resources:` | EVERY service has `deploy.resources.limits.memory` (compose is the enforcement). NO `reservations` anywhere. `.felhom.yml mem_limit` = SUM of all containers' limits (see paperless header comment: 768+256+128=1152M); `mem_request` = expected steady-state usage — NOT display-only: the box's install check adds the installed apps' requests and refuses an app that does not fit (controller `stacks/deploy.go` `memoryVerdict`; set from the 2026-10-13 measurement, R-1125). **Gated since 2026-10-05 (R-758):** `scripts/check-mem-limit-sum.py` (`--fast`, stdlib only) refuses a `mem_limit` that is not the sum and a service with no limit; `steps/` files are not judged. |
|
||||
| Compose file skeleton | `templates/paperless-ngx/docker-compose.yml` (header) | Header comment (app, domain, DB type, RAM math, Pi), `restart: unless-stopped`, `TZ=Europe/Budapest`, explicit `container_name`, `traefik-public` external network + `<app>-internal` for DBs, Traefik labels with ``Host(`${SUBDOMAIN}.${DOMAIN}`)``, named volumes for DB/config (NVMe), `${HDD_PATH}/appdata/<app>/...` for bulk data, `${USERDATA_PATH}/...` for customer-browsable content. |
|
||||
| App-email (SMTP shim) opt-in | `templates/vaultwarden/.felhom.yml` (`smtp_mapping:`) + README.md §smtp_mapping | `smtp_mapping` maps shim host/port/security/from to the app's own env names; compose MUST reference the mapped `${VAR:-}` keys with empty defaults. STARTTLS if the app can accept self-signed certs, else `security_value: "NONE"` plaintext (or the :2526 plaintext listener for STARTTLS-insistent clients — see calcom/nextcloud). TRAP: an image that treats defined-but-EMPTY mail vars as "set" (vaultwarden — campaign F1 2026-07-06) needs its own enable-flag gated `false` in compose and flipped `"true"` via `smtp_mapping.extra`; boot-prove a fresh email-off deploy for every new smtp-mapped app. |
|
||||
|
||||
@@ -167,6 +167,9 @@ GATES = [
|
||||
# R-986 (2026-10-19): the shared dependency and secret scanner, WARN-FIRST (exit 0 whatever it finds). It reads no
|
||||
# network here (no Go module, so no govulncheck); gitleaks on the pushed commits, ~1 s. CI fetches the pinned gitleaks
|
||||
# (FELHOM_SCAN_FETCH=1 in gates.yml).
|
||||
# R-1019 (2026-10-20): a download client's download folder (bound at /downloads or /watch) is declared `excluded`,
|
||||
# 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-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
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""check-download-binds.py — a download client's download folder is never backed up (`excluded`).
|
||||
|
||||
python3 scripts/check-download-binds.py # every template under templates/
|
||||
python3 scripts/check-download-binds.py --root DIR # another checkout (the decoy harness)
|
||||
|
||||
WHY (R-1019, 2026-10-20; felhom.eu `architecture/15-media-library.md` §7). A download folder is large and can be
|
||||
fetched again. Declared `optional`, it is mirrored to the household's second drive every night (Tier 2 = mandatory +
|
||||
optional) and can fill it with films; left UNLISTED, the controller classes a writable `${…_PATH}` bind MANDATORY and
|
||||
it goes off-site too (`stacks/classify_binds.go`; measured 2026-10-14 for Transmission's watch folder). So every
|
||||
download folder is declared `excluded`: no tier copies it (`appbackup.tierKeeps`).
|
||||
|
||||
WHAT IS A DOWNLOAD FOLDER — judged by the FACT, not by an app name: a `${USERDATA_PATH}/<folder>` bind of
|
||||
templates/<app>/docker-compose.yml whose CONTAINER target is `/downloads` or `/watch` (or below them) — where every
|
||||
download client of the catalog writes (qBittorrent, Transmission, NZBGet, SABnzbd on 2026-10-20). The same folder
|
||||
bound a second time elsewhere (qBittorrent binds it at its own path too) is the same folder. Its class is read from
|
||||
.felhom.yml `backup: userdata:` (`- path: <folder>` + `class:`); it must be `excluded`. NOT judged, on purpose:
|
||||
steps/<key>.yml — a ladder step carries the compose only; the backup classes live in .felhom.yml alone.
|
||||
|
||||
STANDARD LIBRARY ONLY (the CI runner has no PyYAML); comments never count.
|
||||
Exit 0 clean · 1 a download folder is optional, mandatory or unlisted · 3 nothing to judge.
|
||||
"""
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
DOWNLOAD_TARGETS = ("/downloads", "/watch")
|
||||
BIND = re.compile(r"""^\s*-\s*["']?\$\{USERDATA_PATH\}/([^:"'\s]+):([^:"'\s]+)""")
|
||||
|
||||
|
||||
def strip_comment(line):
|
||||
out, q = [], None
|
||||
for c in line:
|
||||
if q:
|
||||
if c == q:
|
||||
q = None
|
||||
elif c in "'\"":
|
||||
q = c
|
||||
elif c == "#":
|
||||
break
|
||||
out.append(c)
|
||||
return "".join(out).rstrip()
|
||||
|
||||
|
||||
def is_download_target(target):
|
||||
t = target.rstrip("/")
|
||||
return any(t == d or t.startswith(d + "/") for d in DOWNLOAD_TARGETS)
|
||||
|
||||
|
||||
def download_folders(compose):
|
||||
"""The userdata folders a compose binds at a download target (sorted, de-duplicated)."""
|
||||
out = set()
|
||||
with io.open(compose, encoding="utf-8") as f:
|
||||
for raw in f:
|
||||
m = BIND.match(strip_comment(raw.rstrip("\n")))
|
||||
if m and is_download_target(m.group(2)):
|
||||
out.add(m.group(1).rstrip("/"))
|
||||
return sorted(out)
|
||||
|
||||
|
||||
def userdata_classes(felhom):
|
||||
"""{path: class} from .felhom.yml `backup:` → `userdata:` — a line reader for the catalog's own shape."""
|
||||
out, in_backup, in_userdata, cur = {}, False, False, None
|
||||
if not os.path.exists(felhom):
|
||||
return out
|
||||
with io.open(felhom, encoding="utf-8") as f:
|
||||
for raw in f:
|
||||
line = strip_comment(raw.rstrip("\n"))
|
||||
if not line.strip():
|
||||
continue
|
||||
ind = len(line) - len(line.lstrip(" "))
|
||||
if ind == 0:
|
||||
in_backup, in_userdata, cur = line.startswith("backup:"), False, None
|
||||
continue
|
||||
if not in_backup:
|
||||
continue
|
||||
if ind == 2:
|
||||
in_userdata, cur = line.strip() == "userdata:", None
|
||||
continue
|
||||
if not in_userdata:
|
||||
continue
|
||||
m = re.match(r"^\s*-\s*path:\s*['\"]?([^'\"]+?)['\"]?\s*$", line)
|
||||
if m:
|
||||
cur = m.group(1).strip().rstrip("/")
|
||||
out[cur] = ""
|
||||
continue
|
||||
m = re.match(r"^\s*class:\s*['\"]?([A-Za-z]+)['\"]?\s*$", line)
|
||||
if m and cur is not None:
|
||||
out[cur] = m.group(1)
|
||||
return out
|
||||
|
||||
|
||||
def main(argv):
|
||||
root = ROOT
|
||||
for a in argv:
|
||||
if a.startswith("--root="):
|
||||
root = a.split("=", 1)[1]
|
||||
tdir = os.path.join(root, "templates")
|
||||
if not os.path.isdir(tdir):
|
||||
print("download-binds: nothing to judge — no templates/ under %s" % root)
|
||||
return 3
|
||||
judged, bad = [], []
|
||||
for app in sorted(os.listdir(tdir)):
|
||||
compose = os.path.join(tdir, app, "docker-compose.yml")
|
||||
if not os.path.isfile(compose):
|
||||
continue
|
||||
folders = download_folders(compose)
|
||||
if not folders:
|
||||
continue
|
||||
classes = userdata_classes(os.path.join(tdir, app, ".felhom.yml"))
|
||||
for folder in folders:
|
||||
cls = classes.get(folder)
|
||||
judged.append("%s:%s=%s" % (app, folder, cls or "UNLISTED"))
|
||||
if cls != "excluded":
|
||||
why = ("UNLISTED in backup.userdata — the controller classes it MANDATORY (every tier, off-site included)"
|
||||
if cls is None else "declared `%s` — %s" % (cls, "a nightly copy on the second drive" if cls == "optional" else "copied by the backup"))
|
||||
bad.append("templates/%s: the download folder %s is %s; declare it `class: excluded` (R-1019)" % (app, folder, why))
|
||||
if not judged:
|
||||
print("download-binds: nothing to judge — no template binds a folder at %s" % " or ".join(DOWNLOAD_TARGETS))
|
||||
return 3
|
||||
if bad:
|
||||
print("download-binds gate FAILED (%d of %d download folder(s)):" % (len(bad), len(judged)))
|
||||
for b in bad:
|
||||
print(" " + b)
|
||||
return 1
|
||||
print("download-binds gate OK — %d download folder(s), every one `excluded`: %s" % (len(judged), ", ".join(judged)))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
@@ -71,6 +71,7 @@ COVERS = {
|
||||
"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)",
|
||||
"privileges": "a dangerous key only in a COMMENT, `privileged: false`, `no-new-privileges:true`, a ${HDD_PATH} bind, the docker socket only in a comment, homepage's read-only socket on a test list carrying its old entry - each passes; vs the facts: privileged true, cap_add, a host-root bind, a ${OTHER} bind, homepage's socket on the REAL list (R-981: no exception), app a binding app b's appdata folder or the whole appdata/ or a look-alike name, a folder entry that is a path (R-1142; paperless-ngx's listed appdata/paperless passes), homepage's socket READ-WRITE, the same socket in ANOTHER app or under ANOTHER image or with an added entrypoint or a changed healthcheck, a second service extending it, a YAML merge key, a variable in a bind's options, gpus / provider / a privileged post_start, network_mode host, a driver_opts bind volume, a ${VAR} in a privileged key, the same in a steps/ file, an allow-list copy that differs from the controller's - each refused naming the setting; no templates/ is rc 3; and the stdlib reader equals PyYAML on every catalog file (R-971)",
|
||||
"download-binds": "the download target `/downloads` only in a COMMENT, `class: excluded` only in a COMMENT while the field says optional, the folder bound only in a steps/ file (not judged on purpose), a library bind at /media (not a download target) - vs the facts: a download folder optional, mandatory, UNLISTED (the controller classes it mandatory), a `/watch` sub-folder optional under an excluded parent, a target below /downloads - each refused naming the app; excluded passes; no templates/ and no download bind at all are rc 3, never a pass (R-1019)",
|
||||
"gate-decoys": "this suite, run as a gate of the full run (R-1115): every case above is a decoy of its own gate, and ONE case that stops convicting turns the whole run red - measured 2026-10-17, when the credential-token case had lost its premise (gokapi's login line removed by 326f846) the suite printed FAIL and exited 1; the copy-i18n credential cases now edit an EXISTING line, so a removed premise stops the suite (`edit` raises) instead of passing",
|
||||
}
|
||||
|
||||
@@ -825,6 +826,53 @@ def redis_persistence_cases():
|
||||
shutil.rmtree(ws, ignore_errors=True)
|
||||
|
||||
|
||||
def download_binds_cases():
|
||||
"""check-download-binds.py reads templates/*/docker-compose.yml + .felhom.yml under --root; steps/ not (R-1019)."""
|
||||
global ran
|
||||
ws = tempfile.mkdtemp(prefix="catalog-dlbinds-")
|
||||
try:
|
||||
def compose(binds, comment=""):
|
||||
return ("services:\n dl:\n image: example/dl:1.0\n volumes:\n - dl_config:/config\n%s%s"
|
||||
"volumes:\n dl_config:\n" % (comment, "".join(" - %s\n" % b for b in binds)))
|
||||
def felhom(entries, comment=""):
|
||||
body = "".join(" - path: %s\n class: %s\n" % (p, c) for p, c in entries)
|
||||
return ("display_name: \"DL\"\nbackup:\n volumes:\n - name: dl_config\n class: important\n"
|
||||
" userdata:\n%s%s" % (body, comment))
|
||||
def run(name, files, expect_rc, must=(), no_templates=False):
|
||||
global ran
|
||||
cat = os.path.join(ws, "cat")
|
||||
shutil.rmtree(cat, ignore_errors=True)
|
||||
os.makedirs(cat)
|
||||
if not no_templates:
|
||||
os.makedirs(os.path.join(cat, "templates"))
|
||||
for rel, body in files.items():
|
||||
p = os.path.join(cat, "templates", rel)
|
||||
os.makedirs(os.path.dirname(p), exist_ok=True)
|
||||
io.open(p, "w", encoding="utf-8").write(body)
|
||||
r = sh([sys.executable, os.path.join(ROOT, "scripts", "check-download-binds.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:]))
|
||||
dl = "${USERDATA_PATH}/media/dl:/downloads"
|
||||
print("\n-- download-binds: genuine and decoys (each passes)")
|
||||
run("GENUINE: the download folder excluded", {"dl/docker-compose.yml": compose([dl]), "dl/.felhom.yml": felhom([("media/dl", "excluded")])}, 0, ("every one `excluded`",))
|
||||
run("DECOY: /downloads only in a COMMENT (the field binds /media)", {"dl/docker-compose.yml": compose(["${USERDATA_PATH}/media:/media:ro", "${USERDATA_PATH}/media/dl:/downloads"][:1], comment=" # - ${USERDATA_PATH}/media/dl:/downloads\n") , "dl/.felhom.yml": felhom([("media", "excluded")])}, 3, ("nothing to judge",))
|
||||
run("DECOY: the folder bound only in a steps/ file (not judged)", {"dl/docker-compose.yml": compose([dl]), "dl/.felhom.yml": felhom([("media/dl", "excluded")]), "dl/steps/0123456789abcdef.yml": compose(["${USERDATA_PATH}/media/other:/downloads"])}, 0, ("1 download folder",))
|
||||
print("-- download-binds: the facts (each MUST be refused)")
|
||||
run("FACT: the download folder optional", {"dl/docker-compose.yml": compose([dl]), "dl/.felhom.yml": felhom([("media/dl", "optional")])}, 1, ("templates/dl", "media/dl", "optional"))
|
||||
run("FACT: the download folder mandatory", {"dl/docker-compose.yml": compose([dl]), "dl/.felhom.yml": felhom([("media/dl", "mandatory")])}, 1, ("mandatory",))
|
||||
run("FACT: the download folder UNLISTED (mandatory by default)", {"dl/docker-compose.yml": compose([dl]), "dl/.felhom.yml": felhom([("media/other", "excluded")])}, 1, ("UNLISTED",))
|
||||
run("FACT: `class: excluded` only in a COMMENT, the field optional", {"dl/docker-compose.yml": compose([dl]), "dl/.felhom.yml": felhom([("media/dl", "optional")], comment=" # - path: media/dl\n # class: excluded\n")}, 1, ("optional",))
|
||||
run("FACT: a /watch sub-folder optional under an excluded parent", {"dl/docker-compose.yml": compose([dl, "${USERDATA_PATH}/media/dl/watch:/watch"]), "dl/.felhom.yml": felhom([("media/dl", "excluded"), ("media/dl/watch", "optional")])}, 1, ("media/dl/watch",))
|
||||
run("FACT: a target below /downloads", {"dl/docker-compose.yml": compose(["${USERDATA_PATH}/media/done:/downloads/complete"]), "dl/.felhom.yml": felhom([("media/done", "optional")])}, 1, ("media/done",))
|
||||
run("FACT: no download bind anywhere (nothing to judge)", {"dl/docker-compose.yml": compose(["${USERDATA_PATH}/media:/media:ro"]), "dl/.felhom.yml": felhom([("media", "excluded")])}, 3, ("nothing to judge",))
|
||||
run("FACT: no templates/ at all (nothing to judge)", {}, 3, ("nothing to judge",), no_templates=True)
|
||||
finally:
|
||||
shutil.rmtree(ws, ignore_errors=True)
|
||||
|
||||
|
||||
def privileges_cases():
|
||||
"""check-privileges.py reads templates/*/docker-compose.yml AND steps/*.yml under --root (R-971)."""
|
||||
global ran
|
||||
@@ -2107,6 +2155,7 @@ i18n:
|
||||
image_volumes_cases()
|
||||
redis_persistence_cases()
|
||||
privileges_cases()
|
||||
download_binds_cases()
|
||||
security_scan_cases()
|
||||
|
||||
if fails:
|
||||
|
||||
@@ -30,7 +30,7 @@ resources:
|
||||
backup:
|
||||
userdata:
|
||||
- path: media/metube
|
||||
class: optional # downloaded videos — can be downloaded again; large
|
||||
class: excluded # downloaded videos — can be downloaded again; large: no tier copies them (R-1019)
|
||||
|
||||
# --- Customer-facing folder annotation (R-75) ---
|
||||
data_paths:
|
||||
|
||||
@@ -41,7 +41,7 @@ backup:
|
||||
class: important # the settings, the provider entry AND the queue
|
||||
userdata:
|
||||
- path: media/nzbget
|
||||
class: optional # the downloads themselves - large, and fetchable again
|
||||
class: excluded # the downloads themselves - large, and fetchable again: no tier copies them (R-1019)
|
||||
# Why the queue is in the VOLUME and not on the drive: the app ships with MainDir=/downloads, which
|
||||
# puts the queue, the nzb files, the temp dir and the log on the household's drive - the place this
|
||||
# very file classifies "optional, fetchable again". The compose moves them to /config/data so that
|
||||
|
||||
@@ -43,7 +43,7 @@ backup:
|
||||
# without it every torrent is re-checked or lost from the list
|
||||
userdata:
|
||||
- path: media/torrents
|
||||
class: optional # the downloads themselves - large, and fetchable again
|
||||
class: excluded # the downloads themselves - large, and fetchable again: no tier copies them (R-1019)
|
||||
|
||||
# --- Customer-facing folder annotation (R-75) ---
|
||||
data_paths:
|
||||
|
||||
@@ -44,7 +44,7 @@ backup:
|
||||
class: important # the settings, the provider entry, the queue and the history
|
||||
userdata:
|
||||
- path: media/usenet
|
||||
class: optional # complete/ and incomplete/ - large, and fetchable again
|
||||
class: excluded # complete/ and incomplete/ - large, and fetchable again: no tier copies them (R-1019)
|
||||
|
||||
# --- Customer-facing folder annotation (R-75) ---
|
||||
data_paths:
|
||||
|
||||
@@ -45,9 +45,9 @@ backup:
|
||||
class: important # settings AND the torrent state: without it the list is gone
|
||||
userdata:
|
||||
- path: media/transmission
|
||||
class: optional # the downloads themselves - large, and fetchable again
|
||||
class: excluded # the downloads themselves - large, and fetchable again: no tier copies them (R-1019)
|
||||
- path: media/transmission/watch
|
||||
class: optional # .torrent files dropped in to start them; before 2026-10-14 this bind was unlisted
|
||||
class: excluded # .torrent files dropped in to start them; before 2026-10-14 this bind was unlisted
|
||||
# and so MANDATORY - it went off-site (R-1019)
|
||||
|
||||
# --- Customer-facing folder annotation (R-75) ---
|
||||
|
||||
Reference in new issue
Block a user