fix(domain): security audit follow-ups — deserialise JSON by reference, literal delete paths in the wasm build
The security gate (PASS, 0 blocking) reported LOW items: an imported attachment's Value was copied for the wrapper and the snapshot gate (a hostile 16 MiB attachment multiplied linear memory), and wasm-build.sh deleted its outputs through a variable. Every JSON input is now read with T::deserialize(&Value) (same errors, no copy); one deserialiser instead of two also shrinks the shipped module from 1,180,281 to 1,046,498 bytes raw (372,132 → 340,929 gzip). The two outputs are removed on their literal paths. RUST.md records the numbers, the quarantine retention and the base-image tag residual.
This commit is contained in:
1 parent
8e8c58efca
commit
e49009e363
10 files changed
+39
-29
No files matched your search
@@ -573,19 +573,22 @@ Closed failure kinds: `invalid_json`, `invalid_shape`, `unknown_op`,
|
||||
|
||||
| Measure | Value |
|
||||
|---|---|
|
||||
| shipped module | 1,180,153 B raw (image) / 1,180,281 B (native), **372,275 B served gzip** (budget 600 KB) |
|
||||
| shipped module | 1,046,498 B raw (native), **340,929 B gzip -9** (budget 600 KB); before the by-reference deserialisation of the security follow-up: 1,180,153 B raw / 372,275 B served by the image |
|
||||
| glue | 10,171 B |
|
||||
| load (compile + instantiate) | 8 ms |
|
||||
| sheet handle + index data (bundle 0.5 MB) | 22 ms (TypeScript parse + index on the same input: 12 ms) |
|
||||
| `zone.click` | 0.04 ms |
|
||||
| load (compile + instantiate) | 6 to 8 ms |
|
||||
| sheet handle + index data (bundle 0.5 MB) | 22 to 27 ms (TypeScript parse + index on the same input: 12 to 15 ms) |
|
||||
| `zone.click` | 0.03 ms |
|
||||
| `draft.restore` (demo report) | 0.26 ms |
|
||||
| `archive.import` (demo envelope, 184 KiB) | 2.6 ms (TypeScript layered read, without rebase: 1.0 ms) |
|
||||
| `archive.snapshot` | 0.4 ms |
|
||||
| linear memory after the editor path | 4.0 MiB |
|
||||
| `archive.import` (demo envelope, 184 KiB) | 2.4 ms (TypeScript layered read, without rebase: 1.0 to 1.1 ms) |
|
||||
| `archive.snapshot` | 0.4 to 0.5 ms |
|
||||
| linear memory after the editor path | 4.1 MiB |
|
||||
| app image | 104 MB (wasm stage: the Rust toolchain stays in the builder) |
|
||||
|
||||
Pages without the core load nothing more than before R2; the sheet pages
|
||||
fetch 382 KB more (glue + gzip module) once per session.
|
||||
fetch about 351 KB more (glue + gzip module) once per session. Every JSON
|
||||
input is deserialised by reference (`T::deserialize(&Value)`), never through
|
||||
a copy of the value: a large attachment is not duplicated in linear memory,
|
||||
and one deserialiser instead of two keeps the module smaller.
|
||||
|
||||
### 8.7 Behaviour differences (declared)
|
||||
|
||||
@@ -623,7 +626,13 @@ fetch 382 KB more (glue + gzip module) once per session.
|
||||
- The CSP proof runs Chromium only (no Firefox or WebKit build on this
|
||||
machine): the owner's manual run of the image on other browsers and the
|
||||
phone covers Safari and Firefox.
|
||||
- The module grows with each phase (372 KB of the 600 KB budget at R2; the
|
||||
- The module grows with each phase (341 KB of the 600 KB budget at R2; the
|
||||
`url` crate's IDNA tables are part of it): R3/R4 must keep measuring.
|
||||
- The quarantine slots (`osteo:quarantine:*`) keep verbatim copies of drafts
|
||||
(practitioner, owner and animal data) until the tab closes, the same
|
||||
exposure as `osteo:draft` itself (sessionStorage, tab and origin scoped);
|
||||
nothing clears them on a new report, by design (they exist to survive it).
|
||||
- Base images by tag, the new `rust:1.99.0-bookworm` included (digest pinning
|
||||
is the Step 27 follow-up of R0).
|
||||
- The documented CSP refuses the footer's external credit logo
|
||||
(`img-src`), an older matter seen by the proof.
|
||||
Reference in new issue
Block a user