diff --git a/crates/core/src/bin/report_compare.rs b/crates/core/src/bin/report_compare.rs index 3d8756bb..59cf060b 100644 --- a/crates/core/src/bin/report_compare.rs +++ b/crates/core/src/bin/report_compare.rs @@ -118,8 +118,10 @@ impl Files for Disk { } fn read(&self, path: &str) -> Result, FileFailure> { - // The type is checked before the open (a FIFO or a device is never opened), then - // again on the handle (the path is not swapped for a directory in between). + // The type is checked before the open (a FIFO or a device named on the command line + // is not opened), then again on the handle, which refuses a path swapped in between; + // a local writer swapping in a FIFO between the two calls can still make the open + // wait (operator tool on the operator's own files, accepted). let regular = |meta: &fs::Metadata| { if !meta.is_file() { return Err(FileFailure::NotRegular); diff --git a/docs/development/ENVIRONMENTS.md b/docs/development/ENVIRONMENTS.md index dbea403c..14cb52ad 100644 --- a/docs/development/ENVIRONMENTS.md +++ b/docs/development/ENVIRONMENTS.md @@ -68,6 +68,7 @@ the LAN, the administration tools and the database are not. | Studio | 54323 | **closed** | host firewall rule; from another device: SSH tunnel (§3.4) | | PostgreSQL | 54322 | **closed** | host firewall rule; the CLI and the tests use it on the host | | Worker | none | — | internal, Supabase compose network, read-only, no capability | +| Production build for the R4 recettes (`scripts/browser/serve.mjs`) | 4173 | **closed** by default; open only during a device recette | static build behind the DEPLOY CSP, empty `env.js`, bound to the one DEV address (never a wildcard, refused by the script); the owner opens it for the session, `sudo ufw allow in on enp89s0 from 192.168.1.0/24 to any port 4173 proto tcp comment 'faunosteo recette R4'`, and deletes that rule afterwards (`sudo ufw status numbered`, then `sudo ufw delete `) | | PostgREST, GoTrue, Storage, pg-meta | none | — | behind Kong | ### 3.1 Why a host firewall is required diff --git a/docs/development/PDF_IMPORT_HARDENING.md b/docs/development/PDF_IMPORT_HARDENING.md index 884d5c53..f530c618 100644 --- a/docs/development/PDF_IMPORT_HARDENING.md +++ b/docs/development/PDF_IMPORT_HARDENING.md @@ -159,7 +159,9 @@ only; a refused import leaves the tab's texts in place: app suites | 16 | pdf-lib (unmaintained since 2021) | §5 item 5 | fixed with proof | left the repository at R4.8; `r4.census` | | 17 | Stamped PDFs saved with object streams (before Step 6) read a stripped attachment as `no_attachment` | §4 trade-off | accepted temporarily | pre-Step-6 files only, same outcome as a foreign PDF, no data at stake; documented in PDF-FORMAT | | 18 | Imports offered to external users | §5 gate | before public exposure | the gate stays closed: the import is a local-tool feature; opening it needs items 3, 9 and 12 closed and a fresh audit of the worker path | +| 19 | J2 on the owner's devices (export FR / EN, views and markers, attachment, round trip, L on the phone, repetition) | BDR-063, BDR-060, plan A.4 | blocking before merge | `R4_J2.md` J2.1 to J2.14 on the OD-6 list; every cell NON TESTÉ today; headless runs (RUST.md §10.8, §10.11) never fill a cell | +| 20 | WebKit one-off worker `error` event seen headless at R4.2 / R4.3 | BDR-058 | accepted temporarily | not blocking per BDR-058: kept in the record, never masked (the client classifies every `error` event as a crash, `core/worker/client.ts`), the repetition series showed no recurrence (RUST.md §10.5); closes with J1.9 / J1.10 on the iPhone (Safari iOS) | Owner reading at the R4.9 checkpoint: no item in this table is a code -change pending in R4; items 3 and 9 are the device run (J1), items 12, 15 and -18 are the public-exposure gate, item 7 is measured and bounded (the browser's raster path), its device check is J2.6 / J2.7. +change pending in R4; items 3, 9 and 19 are the device runs (J1 and J2), +items 12, 15 and 18 are the public-exposure gate, item 7 is measured and bounded (the browser's raster path), its device check is J2.6 / J2.7. diff --git a/docs/development/R4_J1.md b/docs/development/R4_J1.md index 8d6dbfce..24d7e956 100644 --- a/docs/development/R4_J1.md +++ b/docs/development/R4_J1.md @@ -21,6 +21,9 @@ Two surfaces, both on the DEV origin (`scripts/dev-env.sh`, 2. The production build behind the DEPLOY CSP (what the proofs ran): `pnpm build:preview` then `. scripts/dev-env.sh && node scripts/browser/serve.mjs --host "$FAUNOSTEO_DEV_HOST" --port 4173` (the server refuses an empty or unspecified address), + reachable from the devices only once the owner opened port 4173 to the + private subnet for the session (`ENVIRONMENTS.md` §3, the 4173 row: + one `ufw allow` rule, deleted afterwards), `http://:4173`. Static files, the nginx SPA fallback, the DEPLOY `Content-Security-Policy` with `'wasm-unsafe-eval'` on every response. `--csp without` serves the same build without the keyword (the diff --git a/docs/development/R4_J2.md b/docs/development/R4_J2.md index 34ff67e1..8de8a609 100644 --- a/docs/development/R4_J2.md +++ b/docs/development/R4_J2.md @@ -19,6 +19,9 @@ As for J1, on the DEV origin (`scripts/dev-env.sh`, `FAUNOSTEO_DEV_HOST`): 1. `pnpm dev:offline` (the local tool), `http://:5173`. 2. The production build behind the DEPLOY CSP: `pnpm build:preview` then `. scripts/dev-env.sh && node scripts/browser/serve.mjs --host "$FAUNOSTEO_DEV_HOST" --port 4173` (the server refuses an empty or unspecified address), + reachable from the devices only once the owner opened port 4173 to the + private subnet for the session (`ENVIRONMENTS.md` §3, the 4173 row: + one `ufw allow` rule, deleted afterwards), `http://:4173`. Surface 2 is the one that matters for the memory items and the CSP. diff --git a/scripts/browser/serve.mjs b/scripts/browser/serve.mjs index 93b12655..f295d29a 100644 --- a/scripts/browser/serve.mjs +++ b/scripts/browser/serve.mjs @@ -23,7 +23,7 @@ import { readFileSync } from 'node:fs' import { readFile, stat } from 'node:fs/promises' import { lookup } from 'node:dns/promises' import { createServer } from 'node:http' -import { BlockList } from 'node:net' +import { BlockList, isIPv6 } from 'node:net' import { extname, join, resolve, sep } from 'node:path' import { pathToFileURL } from 'node:url' import { parseArgs } from 'node:util' @@ -36,12 +36,11 @@ const WILDCARDS = new BlockList() WILDCARDS.addAddress('0.0.0.0', 'ipv4') WILDCARDS.addAddress('::', 'ipv6') -// `dns.lookup` reports the family as 6, `server.address()` as 'IPv6'. -const isWildcard = ({ address, family }) => - WILDCARDS.check( - address.replace(/%.*$/, ''), - family === 6 || family === 'IPv6' ? 'ipv6' : 'ipv4', - ) +// The type comes from the address itself, whatever shape `family` takes. +const isWildcard = ({ address }) => { + const bare = address.replace(/%.*$/, '') + return WILDCARDS.check(bare, isIPv6(bare) ? 'ipv6' : 'ipv4') +} /** * The one address `host` names, resolved before any socket exists: an empty