Files
faunosteo/.claude/audits/2026-11-01-dev-read-incidents.md

60 lines
4.3 KiB
Markdown

# 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.