fix(domain): refuse three non-canonical v3 shapes, R5.5 LOW fixes, R5.6 plan
check_v3_shape at read_report_document v3 and parse_envelope (sheet, practitioner as non-objects, severity as non-string); Protocol errors final; DEV address must be an own unicast address. SQL confirm function and DEV keys characterised, no change.
This commit is contained in:
1 parent
13db5539a3
commit
d502dfa923
11 files changed
+369
-37
No files matched your search
@@ -149,6 +149,31 @@ service-worker features) and OAuth providers that refuse `http://` redirect
|
||||
URIs. When one of those lands, the answer is a private HTTPS origin (local CA
|
||||
or a private name with a certificate), never the production domain.
|
||||
|
||||
### 3.6 The API port 54321 and the stack's keys (checked 2026-10-24)
|
||||
|
||||
Measured on the host, no secret printed: `supabase/config.toml` sets no `jwt_secret` and no
|
||||
signing keys, so the stack signs with the Supabase CLI's **public default** JWT secret and its
|
||||
`service_role` key is the public demo key (`iss: supabase-demo`). Port 54321 is open to the LAN by
|
||||
design (table above): any device of the private network that knows those public values can call
|
||||
the API as `service_role`, past every RLS policy, on DEV data. Nothing of production is involved.
|
||||
This is an owner decision (no automatic change): give the stack its own secret (a `jwt_secret` /
|
||||
signing keys read with `env()` from a git-ignored file, then `pnpm db:reset` and new keys in
|
||||
`.env.worker`), or narrow the 54321 allow rule to the test devices' addresses.
|
||||
|
||||
What the UFW listing alone does not prove for 54321, and how to check it (owner, by hand):
|
||||
|
||||
```bash
|
||||
ss -ltnp 'sport = :54321' # who listens, on which address (0.0.0.0 / [::] expected)
|
||||
sudo ufw status verbose # default incoming policy + any rule naming 54321
|
||||
docker info -f '{{.SecurityOptions}}' # "rootless" expected: published ports are host sockets, UFW applies
|
||||
sudo iptables -S DOCKER-USER 2>/dev/null # rootful Docker only: DNAT bypasses UFW, rules belong here
|
||||
nc -zv -w 3 <DEV host> 54321 # from ANOTHER device: succeeds today (open by design)
|
||||
nc -zv -w 3 <DEV host> 54322 # from another device: must fail (54323, 54324 too)
|
||||
```
|
||||
|
||||
A DENY on 54322 to 54324 is effective only if the daemon is rootless (§3.1) and the probe from
|
||||
another device fails; this machine cannot test its own LAN firewall (§3.3).
|
||||
|
||||
## 4. Procedure from another device (owner validation)
|
||||
|
||||
On the Ubuntu machine: `pnpm db:start`, `pnpm dev:gateway`, the worker
|
||||
|
||||
@@ -3392,3 +3392,47 @@ together with the serde decision above; the seed regenerated once by the Rust to
|
||||
re-uploaded only if their bytes change (they do not: `horse.svg` is frozen); `.prettierignore` on the
|
||||
Rust-written paths; the migration-map cascade debt (§11.12) fixed before any changeset renames a view,
|
||||
zone, region, category or cited reference.
|
||||
|
||||
### 11.18 R5.5 closed; targeted corrections before R5.6 (2026-10-24)
|
||||
|
||||
Owner brief « Clôture R5.5, corrections ciblées et préparation R5.6 ». Contract
|
||||
`.claude/tasks/contracts/2026-10-24-rust-r5-5-closing.md`.
|
||||
|
||||
**Real local stack: PASS, run by the owner by hand** (`pnpm e2e:sheet-assets`, 11 checks, verdict
|
||||
`e2e:sheet-assets OK`). This result is the owner's, distinct from the assistant's simulated-server suite
|
||||
(`upload_tool`); the assistant did not rerun it. R5.5 is closed. FLOOR clarification and the 4 MiB cap
|
||||
accepted; `evals.md:205` stays declared, not requalified.
|
||||
|
||||
**Two LOW corrections.** `Protocol` errors (a malformed HTTP answer, a key a header refuses) are final, no
|
||||
longer retried (test `a_malformed_answer_is_final_and_not_retried`: one request, exit 1). The DEV address must
|
||||
be an own unicast address: bound, then connected to itself (no packet) with that address kept as the local end;
|
||||
a subnet broadcast binds but refuses the connect (binary test over the host's `inet` and `brd` addresses). The
|
||||
other LOW reserves of §11.16 stay tracked.
|
||||
|
||||
**Serde hardening of three v3 shapes (owner go).** `report::read::check_v3_shape` refuses on the raw value,
|
||||
before the typed read, `sheet` or `practitioner` not an object and an observation `severity` not a string
|
||||
(`ReadFailure::Invalid` with the field named). Called at the two entries that read a v3 report from outside:
|
||||
`read_report_document` (v3 branch: PDF import, bare archives, draft restore) and `parse_envelope` (the session's
|
||||
archive copy). Nothing else narrowed: an unknown field and an absent `severity` are read as before; `null`
|
||||
severity was and stays refused (optional, never nullable). Test `characterisation_serde_tolerance` turned
|
||||
around (5 cases, the envelope entry included). Every R2-R4 suite, the PDF import suites, the envelope goldens and
|
||||
the N-1 reader pass unchanged; no authentic archive was rejected. Not covered by the go, left as is: the same
|
||||
derives on Report v2 and on the other contracts.
|
||||
|
||||
**`confirm_sheet_asset_upload`, characterised (no SQL change).** EXECUTE revoked from `public`, `anon`,
|
||||
`authenticated`, granted to `service_role` only (migration 20261009100000; pgTAP 006: an editor gets 42501,
|
||||
the service role confirms, twice is idempotent; `anon` is covered by the grant, not by its own assertion). The
|
||||
function sets `uploaded_at` for the row id without checking that `<sha256>.svg` exists in `storage.objects` or
|
||||
that its bytes match: a service-role caller can confirm a row with no object or with other bytes under the key.
|
||||
Not exploitable from an API role: no INSERT, UPDATE or DELETE policy exists on the bucket, so only the service
|
||||
role can place bytes, and the service role already bypasses RLS. In the tool, the row is confirmed only after the
|
||||
object is read back and hashed. Debt before any public exposure: check the object's existence (and size) in the
|
||||
function. On DEV, see the next point: the service role is reachable from the LAN today.
|
||||
|
||||
**DEV stack (owner §5).** Measured without printing a secret: the stack uses the Supabase CLI's public default
|
||||
JWT secret, the service key is the public demo key (`iss: supabase-demo`), and 54321 is open to the LAN by
|
||||
design, so a device of the network can act as `service_role` on DEV. The checks to run for 54321 (listener, UFW,
|
||||
rootless or rootful Docker, a probe from another device) and the two remedies are in ENVIRONMENTS.md §3.6. No
|
||||
firewall or configuration was changed.
|
||||
|
||||
**R5.6 prepared, not started.** Plan `.claude/tasks/plans/2026-10-24-rust-r5-6-fingerprint-switch.md`.
|
||||
Reference in new issue
Block a user