chore(memory): DEV read incident report, LRN-110 supersedes LRN-102

This commit is contained in:
bchanot committed 2026-11-02 00:25:30 +01:00
1 parent 34a49f5769
commit 8191e3a42c
2 files changed
+68

No files matched your search

@@ -0,0 +1,59 @@
# Incident report: two unauthorised read-only runs against DEV (2026-11-01)
Scope rule broken: the owner's briefs forbid any operation on DEV, read-only included. Evidence is
what was collected right after each event, read-only: Docker start times of the eight DEV containers,
the DEV Kong access log and the DEV Storage request log (`docker logs`). No new connection to DEV was
made to write this report.
## Events
| | Event 1 | Event 2 |
|---|---|---|
| Time (UTC) | 2026-11-01 23:03:49 | 2026-11-01 23:10:59 |
| Origin | feater sub-agent securing `e2e:sheet-assets` (V1-2.3 closure, brief 2026-11-02 §3) | the orchestrator |
| Cause | `cd <worktree> && python3 … &` backgrounded the whole list, so the next command ran in the shell's directory, the main checkout `/home/bchanot/Documents/faunosteo` (branch `feature/v1-1-clients-animals`), where the old script still targets DEV | an unquoted heredoc (`python3 - <<EOF`) writing a TODO line: bash ran the command substitution of the backticked text `pnpm e2e:sheet-assets` in the session directory, the same main checkout |
| Command really run | `pnpm e2e:sheet-assets` → old `scripts/sheet-assets-e2e.sh`: release build of `upload-sheet-assets`, `scripts/supabase.sh status -o json` (DEV service and anon keys read from the local CLI), then its 11 checks | the same |
| Environment reached | DEV: the local Supabase CLI stack, through Kong `http://127.0.0.1:54321` (Storage and PostgREST) | the same |
| Requests observed (Kong) | 13, all GET (detail below) | 13, all GET, same detail |
| Writes observed | none: no POST, PUT, PATCH or DELETE in the Kong log; Storage log shows only `GET` (`storage.bucket.get`, `storage.object.get_authenticated`) | none, same evidence |
| DEV containers | not restarted (start times equal to the snapshot of 2026-10-28) | same |
## The 13 requests of each event (reconciled)
| Requests | Count | Status |
|---|---|---|
| `GET /storage/v1/object/anatomical-sheet-assets/0ea5202f…08541.svg` (equine drawing; `last_modified` 2026-10-23, unchanged) | 5 | 200 |
| `GET /storage/v1/bucket/anatomical-sheet-assets` | 3 | 200 |
| `GET /storage/v1/bucket/anatomical-sheet-assets` (anon key and wrong key, the expected refusals) | 2 | 400 |
| `GET /rest/v1/anatomical_sheet_assets` | 3 | 200 |
| **Total** | **13** | |
The checkpoint of 2026-11-02 said « 4 lectures du bucket » plus « 2 refus », which sums to 14: wrong.
The log has 3 bucket reads answered 200 and 2 answered 400, five bucket requests in all; the total
is 13. The four refusal checks of the script that name another destination (https, a non-local host,
no port, port 9) sent nothing to DEV: the upload tool refuses the first three before any request,
and port 9 is closed.
## What the evidence proves, and what it does not
Proved: no write request reached DEV through Kong, the only route the tool uses (the URL was
`http://127.0.0.1:54321`); the drawing object kept its 2026-10-23 modification date; no DEV container
restarted. Not proved: the state of DEV's database rows (no query was run, by rule); PostgREST and
PostgreSQL logs were not read. The DEV service key was read from the local CLI config and held in the
process environment of those runs; it was never printed (the script's grep guard) and is the local
demo key (`ENVIRONMENTS.md` §3.6).
## Confinement and prevention
- Stopped all work at once after the second event and reported it (checkpoint of 2026-11-02).
- V1-2 branch: `pnpm e2e:sheet-assets` is an alias of `pnpm db:sandbox sheet-assets-e2e` (`f924ad0`);
the runner refuses any URL but `http://127.0.0.1:57800` and any key not issued by the sandbox,
before building or any request (`34a49f5` for the branch-neutral message).
- develop: bugfix `bugfix/sheet-assets-e2e-sandbox-only` (owner authorisation of 2026-11-02): the same
runner, byte for byte; on develop it always refuses (no sandbox runner there yet).
- Remaining vulnerable entry points (not fixed here; owner authorisation needed): see the census in
the checkpoint (develop `scripts/avatar-e2e.sh`; the main checkout on `feature/v1-1-clients-animals`
and the worktree `old-958228a` hold both old scripts on disk).
- Memory: LRN-110 (supersedes LRN-102): quoted heredocs, absolute verified directories, environment
validated inside scripts, the same rules in every sub-agent brief; agents and sub-agents are
forbidden to run those old commands from other worktrees.
+9
View File
@@ -709,6 +709,7 @@ Supersedes [[LRN-100]].
**Context**: any shell-written file holding backticks: Rust/TS doc comments, markdown, commit bodies, python snippets passed via `python3 - <<EOF`.
**Application**: always quote delimiter (`<<'EOF'`, `<<'PYEOF'`) unless expansion wanted; prefer Write/Edit tools for prose; before commit grep added lines for `uid=`, `gid=`, home paths and empty backtick pairs; treat `command not found` lines during a file write as corruption signal, re-read file.
- **Status (2026-11-02)**: superseded by LRN-110
## LRN-103 — SVG pointer-events all hits the stroke area even unpainted: hitboxes declare stroke none + visibleFill (2026-11-01)
**Pattern**: SVG `pointer-events="all"` hits fill AND stroke area whether painted or not. Transparent hitbox with no own `stroke-width` inherits ancestor's: root `stroke-width="2000"` widened every point hitbox, last one took 13 of 19 equine clicks (Chromium, WebKit). `stroke="none"` alone does not shrink hit area under `all`.
@@ -758,3 +759,11 @@ Supersedes [[LRN-100]].
**Context**: V1-2.3 verify child, `rust:1.99.0-alpine3.24` build (musl mallocng), distroless runtime, 2026-11-01. At-caps fixture under full filter died SIGSYS; strace derivation (`crates/worker/scripts/derive-seccomp.sh`) in Docker test stage showed `brk` only missing call. Decode traces (R1) showed neither `brk` nor `mprotect`. Owner approved `brk` in shared filter (brief 2026-11-01), wording of this entry owner-validated.
**Application**: new child command or new input path (bigger frames, other library) → rerun seccomp derivation inside real image on that path before trusting allowlist; add a syscall only when trace proves it, with trace as justification; never infer from native glibc runs.
## LRN-110 — Bash traps that reached DEV: backgrounded cd list, unquoted heredoc backticks; absolute verified cwd, env validated in-script, rules in sub-agent briefs (2026-11-02)
**Pattern**: two Bash traps made a DEV-targeting test run from the main checkout (2026-11-01, 23:03:49 and 23:10:59 UTC, 13 GET each on DEV, no write seen). (1) `cd /path && cmd &` backgrounds the whole AND-list in a subshell: the caller's cwd never changes, next commands run where the shell was. (2) Unquoted heredoc (`<<EOF`) runs command substitution on backticks and `$(…)` in its body: a TODO text holding `` `pnpm e2e:sheet-assets` `` executed that command (LRN-102 had already caught `` `id` ``; its rule was not applied).
**Context**: orchestrator shell writes (python via `python3 - <<EOF`, markdown, TODO, commit bodies) and sub-agent test commands in a multi-worktree repo whose other checkouts still hold old scripts that read DEV keys (`supabase status`). Rule: a wrong cwd must never be able to reach DEV.
**Application**: quote every heredoc delimiter (`<<'EOF'`, `<<'PYEOF'`) unless expansion is wanted, pass values as arguments; prefer Write/Edit for prose. Run commands with an absolute, verified directory (`git -C <abs>`, `pnpm --dir <abs>`, `[ "$(pwd -P)" = <abs> ]` before acting); never `cd X && cmd &`. Validate the environment before any side effect (target URL, key issuer, container name) inside the script itself, so its safety never depends on cwd. Put these rules in every sub-agent brief that may run shell commands, with the explicit ban on running scripts from other worktrees.
Supersedes [[LRN-102]].