docs(docs): R5.3 final-gate fixes declared (RUST.md §11.12-11.13), security final audit, verify record
This commit is contained in:
1 parent
9f11499f2c
commit
314cf04e6a
3 files changed
+262
-8
No files matched your search
@@ -33,3 +33,10 @@ Contract `.claude/tasks/contracts/2026-10-22-rust-r5-draft.md`. Fresh verifier,
|
||||
- C13: undeclared (a) invalid UTF-8 in changes.json / references.json: TS lossy, Rust refused. Fixed: `read_text` lossy, as R5.2 kept for the catalog. Declared: (b) `1e400` in a discarded value, (c) an inherited `Object.prototype` member in a field path; corrected (c') the NUL-key row, (d) test and line counts (8 tests, 2,718 lines).
|
||||
- Notes kept: synthetic refusals assert `is_err` only (the contract asks no reason); `scripts/import-equine.sh` called directly without INIT_CWD resolves a relative `--out` from the repository root (pnpm sets INIT_CWD).
|
||||
- Not re-verified by a fresh verifier after these corrections (docs plus the one-line lossy read); `pnpm check:all` rerun green on the final code (00:10:03), `--check` 12 files 0 differences.
|
||||
|
||||
## Final round on 8654905 (owner 2026-10-23: fresh verifier on C1 to C13 + fresh security)
|
||||
|
||||
- Verifier ECARTS(2): C3 and C13, one defect. A `set` field path whose segment starts with NUL (`name.\u0000touched`, any settable holder, self or subtree) was written and then stripped with the touch marks: author value lost, a record claiming the write; TypeScript refused it at the gate. C1, C2, C4 to C12 MET (15 + 200 tests, `--check` 0/12, 14 destination probes, floor clean).
|
||||
- Security PASS (`.claude/audits/2026-10-23-rust-r5-draft-security-final.md`): MEDIUM-1 a 20,000-segment field path (40 KB changes.json) overflowed the stack; MEDIUM-2 `--out` writes not exclusive after the claim; LOW-1 the NUL field path (same as the verifier); LOW-2 `..` and parents created before a failed claim; LOW-3 a destination inside the seed accepted; LOW-4 INIT_CWD and direct-run base; LOW-5 non-UTF-8 argument panic; LOW-6 clippy disallowed list partial (pre-existing); LOW-7 the test allow line (convention).
|
||||
- Fixed: NUL segment refused at the op (`reserved key`); field paths capped at 8 segments; document depth capped at 64 levels after every op (iterative walk); `--out`: `..` refused, parent must exist, destination inside the seed refused, destination printed before writing, every folder `create_dir`, every file `create_new`; `args_os`. Documented: direct-run base (LOW-4). Kept: LOW-6 (pre-existing lint scope, out of R5.3), LOW-7 (test convention). Tests added: field-path refusals and 20,000 segments refused without crash, 40 nested adds refused at the bound, 8 `--out` refusals against the built binary with nothing written.
|
||||
- Next: a fresh verifier and a fresh security audit on the fixed commit.
|
||||
@@ -0,0 +1,237 @@
|
||||
```
|
||||
SECURITY — VERDICT: PASS
|
||||
TOOL: semgrep 1.168.0 — p/security-audit, p/secrets, p/owasp-top-ten
|
||||
SCOPE: 31 files
|
||||
BLOCKING:
|
||||
(none)
|
||||
REPORTED (non-blocking):
|
||||
- [MEDIUM] unbounded-nesting-stack-overflow — crates/core/src/curation/draft/fields.rs:111
|
||||
- [MEDIUM] out-writes-not-exclusive-toctou — crates/core/src/bin/import_equine.rs:232
|
||||
- [LOW] reserved-nul-key-bypass-via-field-path — crates/core/src/curation/draft/fields.rs:83
|
||||
- [LOW] out-dotdot-and-parent-creation — crates/core/src/bin/import_equine.rs:192
|
||||
- [LOW] out-inside-seed-not-refused — crates/core/src/bin/import_equine.rs:186
|
||||
- [LOW] init-cwd-base-resolution — crates/core/src/bin/import_equine.rs:223
|
||||
- [LOW] args-non-utf8-panic — crates/core/src/bin/import_equine.rs:282
|
||||
- [LOW] core-no-io-lint-partial (pre-existing, context) — clippy.toml:4
|
||||
- [LOW] suppressions (context) — crates/core/tests/curation_draft.rs:7 (new), crates/core/src/bin/import_equine.rs:15 (pre-existing)
|
||||
PROOF: semgrep 163 rules on 31 files → 0 findings; checklist 18 checks → 9 findings (0 CRITICAL, 0 HIGH, 2 MEDIUM, 7 LOW)
|
||||
```
|
||||
|
||||
Security gate, fresh run, 2026-10-23. Scope: `git diff 5e114da..HEAD` (HEAD 8654905, branch
|
||||
`feature/rust-r5-pipeline-core`), 31 changed files, all present. Product files read whole:
|
||||
`crates/core/src/curation/draft/*.rs` (11), `crates/core/src/bin/import_equine.rs`,
|
||||
`crates/core/src/curation/mod.rs`, `crates/core/Cargo.toml`, `crates/core/tests/curation_draft.rs`,
|
||||
`packages/anatomy/tests/r5.curation-synthetic-oracles.test.ts`, `scripts/import-equine.sh`,
|
||||
`package.json`. Docs and `.claude` files grepped for secrets only.
|
||||
|
||||
Semgrep's packs carry few Rust rules, so the Rust review below is manual. Two behaviours were
|
||||
confirmed by a scratch probe (a throwaway binary in the session scratchpad linking
|
||||
`faunosteo-core` with `curation`, run on the mini baseline of `oracles/r5/curation-synthetic.json`;
|
||||
nothing in the repository was touched). `import-equine --out` was never run: its behaviour is
|
||||
traced by reading. `import-equine --check` was run as the brief allows: `legacy-import: 6 files,
|
||||
0 differences`, `draft: 6 files, 0 differences`, 6 pending R5.4 files listed, exit 0, `git status`
|
||||
clean afterwards.
|
||||
|
||||
## Checklist
|
||||
|
||||
| # | Check | Result |
|
||||
|---|---|---|
|
||||
| 1 | Hardcoded secret, token, key, auth URL (diff incl. docs, `.claude`, oracle JSON) | none |
|
||||
| 2 | SQL by interpolation (`seed.rs`) | none, see note A |
|
||||
| 3 | Unsanitized render / eval | n/a (no web output; the TS test has no eval) |
|
||||
| 4 | Sensitive endpoint without authz | n/a (no endpoint; seed SQL design pre-existing) |
|
||||
| 5 | Stack trace / internal path to an end user | none (dev CLI, stderr to the developer) |
|
||||
| 6 | Secret / PII in a log | none |
|
||||
| 7 | Tracked `.env` / credential file | none in the diff (repo tracks `.env.example` only) |
|
||||
| 8 | Guardrails scanner (`api,supabase`) | 0 FAIL; 1 WARN `SB-POLICY-NOT-OWNER` in `supabase/migrations/20261008110000_anatomical_sheets.sql:1177`, outside the diff, dropped (gate rule) |
|
||||
| 9 | Panics from `changes.json` / `references.json`: indexing, unwrap, byte slicing | none, see note B |
|
||||
| 10 | Unbounded recursion, depth and resource caps | MEDIUM-1 |
|
||||
| 11 | Reserved NUL-key refusal | LOW-1 |
|
||||
| 12 | `--out` claim: symlinks, trailing `/`, `.` / `..`, TOCTOU | MEDIUM-2, LOW-2, LOW-3 |
|
||||
| 13 | `INIT_CWD` | LOW-4 |
|
||||
| 14 | `--check` writes nothing | verified (run + read: no write call on that path) |
|
||||
| 15 | Generator writes outside `crates/core/tests/oracles/r5/` | none: one constant path, `curation-synthetic.json`, only under `MAKE_R5_ORACLES=1` |
|
||||
| 16 | Core has no fs / env / clock access | holds by inspection; lint partial, LOW-6 |
|
||||
| 17 | CLI argument handling | LOW-5 |
|
||||
| 18 | New suppressions (anti-gaming) | LOW-7 (context, non-blocking) |
|
||||
|
||||
## Findings
|
||||
|
||||
### MEDIUM-1: nesting built by ops is unbounded, a small `changes.json` aborts the tool
|
||||
|
||||
- Files: `crates/core/src/curation/draft/fields.rs:83-89` (`split_field`, no segment cap) and
|
||||
`:111-126` (`write_field` creates one object per segment); first recursive walker hit
|
||||
`crates/core/src/curation/draft/records.rs:114-123` (`strip_marks`, called at
|
||||
`apply.rs:114`); same class in `records.rs:88-105` (`touch_tree`), `targets.rs:298-322`
|
||||
(`walk`), `apply.rs:129` (`doc.clone()` + `from_value`), and the recursive `Value` drop.
|
||||
- serde_json's 128-level parse limit (no `unbounded_depth` feature) caps each authored value,
|
||||
but the ops build depth past it. A `set` whose `field` is `name` followed by N `.a` segments
|
||||
creates N nested objects in one op.
|
||||
- Probe, release build (the profile `scripts/import-equine.sh` uses): N = 10,000 is refused cleanly
|
||||
(`curated document is not shape-valid: unknown field 'a'`). N = 20,000 (a ~40 KB
|
||||
`changes.json`) gives `thread 'main' has overflowed its stack`, `fatal runtime error: stack
|
||||
overflow, aborting`, exit 134. The debug build (`cargo run` without `--release`) has larger
|
||||
frames and a lower threshold.
|
||||
- The finding tree has the same problem, by analysis only (not run): repeated `add` ops (each up to
|
||||
~63 finding levels under the parse limit) or `move` chains deepen the tree without limit.
|
||||
`walk` clones the growing path for every entry, so memory grows with depth² before the stack
|
||||
overflows.
|
||||
- Impact: the process aborts where it should give a typed refusal. It still fails closed: the
|
||||
pipeline (`folders()`) runs before `claim_destination`, so no folder is created and nothing is
|
||||
written. The input is a committed, owner-authored file. Robustness of a dev tool, and a gap in
|
||||
the "depth and resource caps kept" requirement. Not exploitable beyond a crash.
|
||||
- Fix: cap `split_field` segments, refusing beyond the deepest settable path (`name.fr`,
|
||||
`count_range.min`, `geometry.cx`: 2 segments, so a cap of 4 is generous). Cap the finding tree
|
||||
depth with an iterative check after each `add` and `move`, e.g. a `MAX_FINDING_DEPTH` constant
|
||||
that refuses with the change id and op index.
|
||||
|
||||
### MEDIUM-2: `--out` writes are not exclusive, so the claim can be raced
|
||||
|
||||
- File: `crates/core/src/bin/import_equine.rs:232-247` (`write`: `fs::create_dir_all` at :239,
|
||||
`fs::write` at :242), together with `:186-219` (`claim_destination`).
|
||||
- The claim checks the folder once: absent then `mkdir`, or existing and empty. The writes then
|
||||
use `create_dir_all`, which follows an existing symlink, and `fs::write`, which is `O_CREAT |
|
||||
O_TRUNC` and follows symlinks. Anything planted between the claim and the writes is followed or
|
||||
truncated. That could be `<out>/draft` turned into a symlink to the real seed `draft/`, or a
|
||||
file created early. The claimed path could also be swapped for a symlink before `canonicalize`
|
||||
(:218). An existing empty folder is accepted whatever its owner and mode. The cross-user vector
|
||||
is an empty, world-writable folder pre-created by another account in a shared location.
|
||||
- The doc comment at :182-185 says "created here, so nothing can appear between the check and the
|
||||
writes". That holds against a symlink at the final component (`mkdir` gives `EEXIST`), but not
|
||||
against entries created inside the folder afterwards.
|
||||
- Impact: a concurrent same-user process, or a hostile local account on a multi-user host, can
|
||||
redirect or overwrite files. On the single-user dev machine this needs an attacker who already
|
||||
has the user's rights. It is still an overstatement of the "never overwrites" guarantee the
|
||||
owner asked for, and the std-only fix is cheap.
|
||||
- Fix: create every subfolder under the root with `fs::create_dir`, never `_all` (fails on any
|
||||
existing entry and does not follow a final symlink). Write every file with
|
||||
`OpenOptions::new().write(true).create_new(true)` (`O_EXCL`: refuses an existing file or
|
||||
symlink). Optionally refuse an existing claimed folder that is not owned by the current uid or
|
||||
is group/world-writable (`std::os::unix::fs::MetadataExt`). Correct the comment.
|
||||
|
||||
### LOW-1: the reserved NUL-key refusal does not cover dotted `field` segments
|
||||
|
||||
- Files: `crates/core/src/curation/draft/schema.rs:389-410` (`reserved_key` scans JSON object keys
|
||||
only), `fields.rs:83-89` (`split_field` accepts any non-empty segment), `records.rs:16`
|
||||
(`TOUCH_MARK = "\u{0}touched"`), `records.rs:114-123` (`strip_marks` removes that key at every
|
||||
level).
|
||||
- Probe: `{"op":"set","target":"finding:hip/hip-dysfunctions/mobility","field":"name.\u0000touched","value":"author text"}`
|
||||
is accepted. The document's `name` stays `{"fr":"mobility fr","en":"mobility en"}` and a record
|
||||
`field="name.\0touched" after="author text"` is still emitted. The authored value is dropped
|
||||
silently while the trace (the R5.4 CHANGELOG) claims the write. Any other NUL-prefixed segment,
|
||||
e.g. `name.\u0000other`, is refused by the strict shape gate. The TypeScript kept the key and
|
||||
refused at that gate.
|
||||
- No review-rule bypass: the first segment must be settable, so the mark cannot be set at item
|
||||
level. Every authored JSON key holding the mark is refused at parse.
|
||||
- Fix: refuse a `field` segment that starts with `\0` (in `split_field` or the `SetOp` parse),
|
||||
with the same "reserved key" message.
|
||||
|
||||
### LOW-2: `..` is kept and resolved after symlinks, and a failed claim leaves created folders
|
||||
|
||||
- File: `crates/core/src/bin/import_equine.rs:192-200`.
|
||||
- Rebuilding the path from `components()` drops a trailing `/` and inner `.` components, which is
|
||||
correct: a final symlink is then refused by `symlink_metadata`, dangling links included.
|
||||
`..` is kept, though, and the kernel resolves it after any symlinked component.
|
||||
`--out link/../new` creates `<parent of link target>/new`, not the lexical `./new`.
|
||||
`--out link/..` is always refused (the parent of the target is never empty).
|
||||
- In the absent branch, `create_dir_all(parent)` runs before the final `create_dir`. A claim that
|
||||
then fails, e.g. `--out link/new/..` (`mkdir ..` gives `EEXIST`), leaves `<link target>/new`
|
||||
behind, created through the symlink, while the tool prints "nothing written".
|
||||
- Parent symlinks are followed by design (doc comment), but the resolved destination is printed
|
||||
only after the files are written.
|
||||
- Fix: refuse any `Component::ParentDir`. Create only the final component, refusing a missing
|
||||
parent, or document the parent creation. Print the canonical destination before the first
|
||||
write.
|
||||
|
||||
### LOW-3: a destination inside the official seed tree is not refused
|
||||
|
||||
- File: `crates/core/src/bin/import_equine.rs:186-219`.
|
||||
- `--out supabase/seed/anatomical-sheets/equine/x` passes the claim, being absent, and writes
|
||||
`x/legacy-import/...` and `x/draft/...` inside the seed. Committed files are never overwritten,
|
||||
and the populated folders (`legacy-import/`, `draft/`) are refused as not empty. The owner
|
||||
requirement "never modifies the official seed automatically" holds, since this needs an
|
||||
explicitly typed path. But generated folders can land untracked in the seed, and `--check` then
|
||||
reports them as "not produced".
|
||||
- Fix: refuse when the canonical destination is under `fs::canonicalize(SEED)`, or under the
|
||||
repository root.
|
||||
|
||||
### LOW-4: `INIT_CWD` and the base of a relative `--out`
|
||||
|
||||
- Files: `crates/core/src/bin/import_equine.rs:223-229`, `scripts/import-equine.sh:12`.
|
||||
- Any absolute `INIT_CWD` in the environment is trusted, including one inherited or left stale by
|
||||
an outer pnpm. Without pnpm, the script `cd`s to the repository root, so a relative `--out` from
|
||||
`bash scripts/import-equine.sh` resolves against the repository root, not the caller's folder.
|
||||
The doc says "else the current one". If `current_dir()` fails, the base becomes empty and the
|
||||
path stays relative to a cwd that no longer exists, which fails harmlessly. Not dangerous with
|
||||
the claim rules (new or empty folder only), but surprising.
|
||||
- Fix: print the resolved destination before claiming, and state in the doc that direct runs
|
||||
resolve from the repository root. Or refuse a relative `--out` when `INIT_CWD` is unset.
|
||||
|
||||
### LOW-5: a non-UTF-8 argument panics
|
||||
|
||||
- File: `crates/core/src/bin/import_equine.rs:282` (`env::args()` panics on non-Unicode argv).
|
||||
Self-inflicted, CLI only, not reachable from `changes.json`.
|
||||
- Fix: `env::args_os()` and a usage error on a non-UTF-8 argument.
|
||||
|
||||
### LOW-6 (pre-existing, context): the core's no-I/O guarantee is only partly lint-enforced
|
||||
|
||||
- File: `clippy.toml:4-14` (not in this diff). `disallowed-methods` lists `fs::read`,
|
||||
`read_to_string`, `write`, `File::open`, `File::create`, `env::var`, `var_os` and the clocks.
|
||||
It does not list `fs::create_dir(_all)`, `remove_file`, `remove_dir(_all)`, `read_dir`,
|
||||
`rename`, `copy`, `metadata`, `symlink_metadata`, `canonicalize`, `OpenOptions::open`,
|
||||
`env::current_dir`, `env::args(_os)` or `process::Command::new`.
|
||||
- A grep of `crates/core/src/curation/` finds no `std::fs`, `std::env`, `std::process`,
|
||||
`OpenOptions` or `unsafe`, and no `allow(clippy` in the draft modules. The claim holds today by
|
||||
inspection, not by lint.
|
||||
- Fix: extend the list so a future library change cannot add file system access unnoticed.
|
||||
|
||||
### LOW-7 (context): suppressions
|
||||
|
||||
- New: `crates/core/tests/curation_draft.rs:7`
|
||||
`#![allow(clippy::disallowed_methods, clippy::unwrap_used, clippy::expect_used)]`. This is a
|
||||
test target, the established pattern of the crate's integration tests (`anatomy_*`,
|
||||
`archive_rules`, `curation_format`, `curation_legacy` and others), and the pattern `clippy.toml`
|
||||
itself documents ("Tests ... allow these lints locally where they own I/O"). It allows a
|
||||
robustness/architecture lint, not a security scanner (`nosemgrep`, `nosec`, `eslint-disable
|
||||
security`), so it is not counted as an un-gated suppression.
|
||||
- Pre-existing: `crates/core/src/bin/import_equine.rs:15` `#![allow(clippy::disallowed_methods)]`
|
||||
(present at 5e114da, line 11).
|
||||
- No `nosemgrep`, `nosec`, `eslint-disable`, `ts-ignore` or `noqa` was added in product files.
|
||||
|
||||
## Notes (verified, no finding)
|
||||
|
||||
A. Seed SQL (`seed.rs`). Every single-quoted value is a constant or derived from one:
|
||||
`sheet_id_for(EQUINE_SPECIES_ID, EQUINE_SHEET_VERSION)`, sha256 hex, the uuid asset id, `usize`,
|
||||
`horse.svg`, the description and the change note. Quotes are doubled, and backslashes are literal
|
||||
under `standard_conforming_strings`. Author data reaches only the dollar-quoted document literal,
|
||||
which is refused when the JSON contains `$equine_doc$`. The close cannot overlap the body's tail,
|
||||
because the body is a pretty-printed JSON object trimmed to its final `}`, so no suffix of it is a
|
||||
prefix of the tag. Ported verbatim from `seed.ts`.
|
||||
|
||||
B. Panics. Library unwrap/expect are denied by workspace lints. Every index is guarded:
|
||||
`numbers[0..3]` after `len == 4`, `ids[0]`/`[1]`/`[2..]` after the `ids.len() >= 2` check for
|
||||
findings, and `split_field(..)?[0]` on a non-empty split. Byte slices cut on ASCII `:` and `/`
|
||||
(char boundaries). `Vec::insert` is bounded by `insertion_index` (checked `<= len`, `After` gives
|
||||
at most `len`). `Vec::remove` uses an index `locate` just resolved. `move` re-locates the
|
||||
destination after the removal. `u64` positions saturate and are refused by the range check.
|
||||
The only aborts found are the stack overflows of MEDIUM-1 (`panic = "abort"` in release; a stack
|
||||
overflow aborts in any profile).
|
||||
|
||||
C. Strict validation. `deny_unknown_fields` on every authored struct; the `op` tag is removed
|
||||
before strict parsing of the variant. `.optional()` semantics: `null` is refused, absent is
|
||||
accepted. `CHG-\d{3,}` ids, duplicate change and reference ids, level C without a question, the
|
||||
reserved `CHG-000` and empty ops or citations are all refused. Repeated JSON keys keep the last
|
||||
value, as `JSON.parse` does. `references.json` is parsed into the strict `Reference`.
|
||||
|
||||
D. `--check` only reads: `fs::read`, `read_dir`, `is_dir`. `listed` follows directory symlinks in
|
||||
the seed. A loop ends in an `ELOOP` error and a symlinked file is only compared, never printed.
|
||||
These are trusted, committed contents.
|
||||
|
||||
E. The oracle generator writes only
|
||||
`crates/core/tests/oracles/r5/curation-synthetic.json` (`resolve(HERE, '../../../crates/core/tests/oracles/r5')`,
|
||||
a constant), only when `MAKE_R5_ORACLES === '1'`, and otherwise just compares.
|
||||
`crates/core/tests/curation_draft.rs` only reads.
|
||||
|
||||
F. Secrets: none in the 31 files (diff grep for key, token, password, bearer, `service_role`, JWT,
|
||||
PEM, cloud key prefixes and `user:pass@` URLs; semgrep `p/secrets` 0). The references use example
|
||||
URLs without credentials.
|
||||
@@ -2899,9 +2899,9 @@ re-cleaned; the review drawings and the two Markdown reports are R5.4. Contract
|
||||
| `stats.rs` | `documentStats`: 17 fields in the TypeScript order, the fixed-key counters extended by unlisted values |
|
||||
| `seed.rs` | `renderDraftSeedSql`: header, sheet insert, asset inserts, `insert_sheet_draft`, converging update, the dollar-tag refusal, `trimEnd` |
|
||||
| `pipeline.rs` | `buildEquineDraft` (CHG-000 from the frozen asset's sha256, byte size and uuid, the head view box parsed from the legacy SVG; the reserved id refused), `renderDraftArtifacts` for the R5.3 files (`document.json`, `assets.json`, `sheet-ref.json` with `document_sha256` = sha256 of the `document.json` bytes, `report-migration-map.json`, `equine_draft.sql`), `parseViewBox` |
|
||||
| `bin/import_equine.rs` | both folders; `--check` compares the produced files with the committed seed and lists the six R5.4 files of the draft as pending (`shortcut:` comment, removed at R5.4); `--out <dir>` writes `<dir>/legacy-import` and `<dir>/draft` into a destination that is absent or an empty folder, refuses an empty path, a symbolic link, a path that is not a folder, a folder holding any file; an absent destination is created before any write (nothing can appear between the check and the writes) and the files go to its canonical path, which the success line prints (a symbolic link among the parent folders is visible there); a relative path is typed from `INIT_CWD` when absolute, else the current folder; nothing is ever deleted |
|
||||
| `bin/import_equine.rs` | both folders; `--check` compares the produced files with the committed seed and lists the six R5.4 files of the draft as pending (`shortcut:` comment, removed at R5.4); `--out <dir>` writes `<dir>/legacy-import` and `<dir>/draft` into a destination that is absent or an empty folder; it refuses an empty path, a path holding `..`, a missing parent folder, a destination inside the seed folder, a symbolic link (a trailing `/` or `/.` included), a path that is not a folder and a folder holding any entry; the parent's symbolic links are resolved and the canonical destination is printed before the first write; every folder under it is created with `create_dir` and every file with `create_new`, so an entry that appears after the claim (file, folder or symbolic link) is refused, never followed or truncated; a relative path is typed from `INIT_CWD` when absolute, else the current folder (the repository root when `scripts/import-equine.sh` is run directly, since it moves there; `pnpm r5:import-equine` is the reference); a non-UTF-8 argument is a usage error; nothing is ever deleted |
|
||||
|
||||
Parity, every expectation written by the TypeScript (`tests/curation_draft.rs`, 10 tests):
|
||||
Parity, every expectation written by the TypeScript (`tests/curation_draft.rs`, 13 tests):
|
||||
|
||||
- the five R5.3 text files of the committed `draft/` byte for byte, the frozen `horse.svg`
|
||||
described by its sha256, size and asset id; `pnpm r5:import-equine --check`: 12 files, 0
|
||||
@@ -2939,8 +2939,10 @@ reproduced byte for byte):
|
||||
| nesting deeper than 128 levels (an `add` of a 70-level finding chain) | accepted | refused at parse (serde_json's depth limit, kept as a resource bound) |
|
||||
| a number beyond the double range (`1e400`) in a value a later op overwrites or removes | `JSON.parse` read Infinity, the value was discarded, the change accepted (a surviving value is refused by both at the gate) | refused at parse (serde_json's range check) |
|
||||
| a `set` field path ending in an inherited `Object.prototype` member (`name.constructor`, `name.toString`, `name.valueOf`…) | `readField` returned the inherited function and the record's `structuredClone` threw (`… could not be cloned`): change refused at the op | the member is an ordinary missing key: written, `before` recorded as null. Kept alone, the shape gate refuses it (every object of the sheet contract is strict). Replaced by a later op of the run (a `set name` on the same item), the change is accepted: the document is byte for byte the one the later op alone gives, one extra record traces the overwritten write. Nothing is bypassed: the settable table checks the first segment on both sides (`constructor` as a field: `unknown field`), no value is read through a prototype, the integrity gate runs on the final document (test `an_inherited_member_name_is_a_plain_key_and_bypasses_nothing`, five member names). Accepted by the owner 2026-10-23 |
|
||||
| a `set` field path ending in `__proto__` (`name.__proto__`) | the prototype setter swallowed the write: change accepted, document unchanged, one record | the key is written and the strict document gate refuses it (the R5.2 family: a name of `Object.prototype` is a plain key) |
|
||||
| an authored key starting with NUL (`"\u0000touched"`) in a value | refused at the strict document gate when the value reaches the document, accepted when a later op overwrites or removes it | refused at parse (`reserved key`): the prefix is reserved for the applier's transient touch marks |
|
||||
| a `set` field path ending in `__proto__` (`name.__proto__`) | the prototype setter swallowed the write: change accepted, one record, the document unchanged (or, when the holder was absent, `description: {}` added by `writeField`) | the key is written and the strict document gate refuses it (the R5.2 family: a name of `Object.prototype` is a plain key) |
|
||||
| an authored key starting with NUL (`"\u0000touched"`) in a value, or a field path segment starting with NUL (`name.\u0000touched`) | refused at the strict document gate when the key reaches the document, accepted when a later op overwrites or removes it | refused (`reserved key`): at parse for a value, at the op for a field path; the prefix is reserved for the applier's transient touch marks, which the cleanup strips at every depth, so a written key would be lost while a record claims it (found by the final gates, test `a_reserved_or_unbounded_field_path_is_refused_without_writing`) |
|
||||
| a field path of more than 8 segments (the deepest settable path has 2) | accepted, the gate refused the stray keys | refused at the op: a resource bound (20,000 segments overflowed the stack before it) |
|
||||
| a document nested more than 64 levels after an op (the equine document has 10), by repeated `add` or `move`, or a deep value | accepted when valid | refused at the op: a resource bound checked after every op with an iterative walk (test `the_document_cannot_be_nested_past_the_bound_by_repeated_adds`) |
|
||||
|
||||
Technical debt, kept during R5 (owner decision 2026-10-23, reproduced as is, never corrected
|
||||
silently): `applyRecord` of the migration map reads `record.op` whatever `record.target` is.
|
||||
@@ -2966,7 +2968,7 @@ never matches; `String(x)` of a missing id is `"undefined"`; the error messages
|
||||
(`unknown target "…" (no "…")`, `position N out of range`, …) are the TypeScript ones with
|
||||
the change id and op index prefixed.
|
||||
|
||||
Tests: `cargo test -p faunosteo-core --features curation` (draft 10, importer 5, formatting
|
||||
Tests: `cargo test -p faunosteo-core --features curation` (draft 13, importer 5, formatting
|
||||
6, plus the crate's suites); anatomy 142 (the generator added); `pnpm rust:check` green.
|
||||
|
||||
Gates: security auditor PASS (semgrep 0 findings, 6 LOW; fixed: the head view box read with
|
||||
@@ -2989,14 +2991,22 @@ and three refusals by design now declared above (lone surrogate, depth, `__proto
|
||||
met C1 to C12 and found the documentation incomplete: the curation files are now read lossily
|
||||
as the TypeScript read them (a Latin-1 byte had been refused), two contrived splits are
|
||||
declared above (`1e400` in a discarded value, an inherited member in a field path), and the
|
||||
NUL-key row and the counts are corrected.
|
||||
NUL-key row and the counts are corrected. Final round on 8654905 (owner 2026-10-23): verifier
|
||||
ECARTS(2) and security PASS with 2 MEDIUM, one shared root: a NUL-prefixed field path segment
|
||||
was written then stripped with the marks, its value lost while a record claimed it (fixed:
|
||||
refused at the op); 20,000 field segments overflowed the stack (fixed: 8 segments, 64 levels
|
||||
checked after every op); `--out` writes were not exclusive after the claim (fixed:
|
||||
`create_dir` and `create_new`); `..`, a missing parent and a destination inside the seed are
|
||||
refused, the destination printed before writing, a non-UTF-8 argument refused; the binary's
|
||||
refusals are tested against the built binary (`out_refuses_every_unsafe_destination_and_writes_nothing`).
|
||||
|
||||
### 11.13 Checkpoint R5.3
|
||||
|
||||
Residual risks: the `--check` allowance for the six R5.4 files hides nothing about the
|
||||
produced files but means the draft folder is not yet compared whole (R5.4 removes it); the
|
||||
touch marks are a reserved key (a NUL character starts it), refused in any authored value at
|
||||
parse and removed after each change, so no mark reaches a record or the document; the migration-map replay quirk above
|
||||
touch marks are a reserved prefix (a NUL character starts it), refused in any authored value
|
||||
at parse and in any field path segment at the op, and removed after each change, so no mark
|
||||
reaches a record or the document; the migration-map replay quirk above
|
||||
is reproduced, not fixed; the emoji, Markdown and Unicode-table risks of §11.11 stand.
|
||||
|
||||
Conditions for R5.4: the owner's validation of this checkpoint; the review drawings
|
||||
|
||||
Reference in new issue
Block a user