Pārlūkot izejas kodu

docs: scope the unheld-package exposure honestly - unattended-upgrades never touches our origin

Measured rather than assumed, after a consumer ran the same check on their
box and correctly reached the opposite conclusion. unattended-upgrades is
enabled and active on prod, but its Origins-Pattern allows only Debian and
Debian-Security; a --dry-run --debug prints 'Marking not allowed ...
o=Smartbotics ... with -32768 pin' and then adjusts the candidate back to
the installed version. So nothing of ours is ever auto-upgraded, and the
window with the hold missing was exposure to a human typing apt upgrade
during routine maintenance, not to a nightly job.

Still worth the hold, since routine maintenance is exactly when someone
types it, but that is a smaller claim than the one I made and the smaller
claim is the true one.

The consumer's framing is the keeper: the question is not whether a hold
is still set but what actually protects the versions you depend on. Their
box wanted no hold at all, and their real gap was a backports package
matched by no pattern - the thing that rots fastest being the one nothing
refreshes. Same check, opposite correct answers, so measure the policy
rather than copy the remedy.
fszontagh 1 mēnesi atpakaļ
vecāks
revīzija
00227042b7
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 3 1
      CLAUDE.md

+ 3 - 1
CLAUDE.md

@@ -220,8 +220,10 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **To actually hold a start for this package: `systemctl mask` the unit for the duration**, confirmed upstream - a masked unit REFUSES the start and the postinst's `|| true` absorbs the failure, so the install completes with nothing running. Then unmask and start deliberately. Upstream is also moving the postinst to `deb-systemd-invoke` so `policy-rc.d` will work too, but that is ROADMAP, not shipped. Whichever route, PROVE it by reading `ActiveEnterTimestamp` before and after the install rather than assuming the hold took.
 - **A DATABASE OUTAGE ERASES ITS OWN EVIDENCE FROM THE FUNCTION RUN LOG, because the run log lives in the database.** Observed by a consumer diagnosing the 50-second window: ZERO recorded function runs inside it, not failures. They had to infer the gap from the surrounding minute-cron ticks (16:21:05, then 16:22:46) rather than read it. So when diagnosing a past outage, the run log goes QUIET rather than showing errors, and absence of failures there is not evidence that nothing failed - the same absence-is-not-information trap as a missing `scan_capped`, one layer out.
 - **THE DATABASE PACKAGES ARE ON APT HOLD, so an upgrade needs `--allow-change-held-packages` or it FAILS.** `apt-mark showhold` lists `smartbotic-database` and `libsmartbotic-db-client`; our three app packages are not held, which is why an ordinary vectorapi release needs nothing special. A pinned install without the flag dies with `E: Held packages were changed and -y was used without --allow-change-held-packages` - caught here by a `--dry-run` a few hours before a window, which is the only reason it was not discovered mid-outage. **Prefer the FLAG over `apt-mark unhold` plus a re-hold:** the hold is per PACKAGE rather than per version, so it survives the upgrade and keeps protecting the new version automatically, whereas the unhold route leaves the database freely upgradable if the re-hold is ever forgotten - a protection silently switched off is worse than an install that refuses.
-  **AND THAT IS EXACTLY WHAT HAPPENED. THE HOLD WAS GONE, MEASURED 2026-10-15: `apt-mark showhold` printed NOTHING** and `dpkg -l` showed `ii` rather than `hi` for all three. So the 2.17.2 window took the unhold route, the re-hold was forgotten, and the protection this paragraph calls load-bearing was off for three days with nothing to show it. **`smartbotic-database 2.18.0-1` was sitting in apt at that moment**, so any routine `apt-get upgrade` on that box would have upgraded the database, the client and the CLI, and the database postinst calls `systemctl` DIRECTLY - so it would have restarted prod and run whatever 2.18.0's first boot does, unannounced, on a box holding four tenants' data. Re-held all three (the CLI too, since it is version-matched to the client), and **verified the control actually fires rather than trusting the command's output**: `apt-get -s upgrade` now reports them under "The following packages have been kept back" with ZERO `Inst` lines. A deliberate upgrade still works with `--allow-change-held-packages`.
+  **AND THAT IS EXACTLY WHAT HAPPENED. THE HOLD WAS GONE, MEASURED 2026-10-15: `apt-mark showhold` printed NOTHING** and `dpkg -l` showed `ii` rather than `hi` for all three. So the 2.17.2 window took the unhold route, the re-hold was forgotten, and the protection this paragraph calls load-bearing was off for three days with nothing to show it. **`smartbotic-database 2.18.0-1` was sitting in apt at that moment**, so a routine `apt-get upgrade` TYPED BY A HUMAN would have upgraded the database, the client and the CLI, and the database postinst calls `systemctl` DIRECTLY - so it would have restarted prod and run whatever 2.18.0's first boot does, unannounced, on a box holding four tenants' data. Re-held all three (the CLI too, since it is version-matched to the client), and **verified the control actually fires rather than trusting the command's output**: `apt-get -s upgrade` now reports them under "The following packages have been kept back" with ZERO `Inst` lines. A deliberate upgrade still works with `--allow-change-held-packages`.
   Two things worth taking from it. The note PREDICTED this failure in writing and the prediction still came true, because a written warning is not a control - **check `apt-mark showhold` as part of closing any window that touched a held package**, since the evidence is one command and the failure is invisible until the day it costs an outage. And it was found by accident, while verifying something unrelated: the `ii`/`hi` column appeared in a listing I had pulled to check a version. That is the second time this exact column has carried the answer while being read past.
+  **SCOPE THAT EXPOSURE HONESTLY, THOUGH: `unattended-upgrades` WOULD NOT HAVE DONE IT.** It is installed, enabled, active and running daily on prod, but its `Origins-Pattern` allows only `origin=Debian` with `label=Debian` or `Debian-Security`. Our own repo is `o=Smartbotics,l=Smartbotics`, and a `--dry-run --debug` says so in as many words: **"Marking not allowed ... o=Smartbotics ... with -32768 pin"**, then "adjusting candidate to version libsmartbotic-db-client=2.17.2-1". So nothing of OURS - database, client, CLI or the three app packages - is ever auto-upgraded, and the unheld window was exposure to a human typing `apt upgrade` during routine maintenance, not to a nightly job. That is still worth the hold, because routine maintenance is exactly when someone types it, but it is a smaller claim than "it could have gone at any moment" and the smaller claim is the true one.
+  **The generalisation came from a consumer who ran the same check and got the OPPOSITE answer, correctly: the question is not "is my hold still set" but "what actually protects the versions I depend on".** On their box, no hold is wanted - `unattended-upgrades` covering Debian means their Node 20 pin is unreachable anyway, since the archive cannot move nodejs off 20.x within Debian 13, and adding a hold there would only block security fixes. Their real gap was the mirror image of ours: a backports package (`o=Debian Backports`) matched by no pattern, so **the package that rots fastest is the one nothing refreshes**. Two boxes, same check, opposite correct answers - which is why the rule is to measure the policy rather than copy the remedy. A pin added in the wrong place costs security updates.
   **CHECK THE SERVER'S VERSION WITH `smartbotic-db-cli server-info`, NEVER with `db_client` FROM `/api/v1/version`.** A consumer pushed back on a claim of mine that rested on the latter, correctly: `db_client` is the version of the client library the BUILD LINKS, and a lock's scope is a SERVER property, so that field cannot establish it - the same trap this file already records from the other direction, where a 2.14 client against a 2.13 server reads 2.14.0 while the capped path runs. Verified properly: `server-info` reports `server: 2.17.2 (commit 0cd2285)` and the server's own view of the client. The general form is that **a claim about the server needs a server-side measurement, and a version string is the weakest kind of evidence available for it** - prefer the measured behaviour when you have it.
   **The signal was in plain sight and I walked past it.** `dpkg -l` prints `hi` rather than `ii` for a held package, and that appeared in the very first prod inventory of the day; I read the versions out of that output and ignored the status column. Always `--dry-run` a pinned install before a window and read what it says it will do: this one also confirmed 2 upgraded, 1 newly installed (`smartbotic-db-cli`, which is how `encryption-verify` arrives on prod), 0 removed and nothing held back.
 - **Abseil ABI:** `smartbotic-database`/client debs must be built against the system's current Abseil; a stale build crash-loops on `libabsl_*.so.<old>`. Rebuild the DB if it won't start.