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:
bchanot committed 2026-10-14 01:02:30 +02:00
1 parent 8e8c58efca
commit e49009e363
10 files changed
+39 -29

No files matched your search

+3 -1
View File
@@ -23,21 +23,23 @@ fi
# Two modules from the same sources: pkg/ is the one the application ships (no trap export),
# pkg-proofs/ adds the R0 trap exports for the poison-and-reinstantiate tests only (R2 plan P10).
# The caller removes the previous output on its literal path first (never through a variable).
build_module() {
local out="$1"
shift
cargo build -p faunosteo-wasm --release --target wasm32-unknown-unknown --locked "$@"
rm -rf "$out"
wasm-bindgen --target web --out-dir "$out" --out-name faunosteo_wasm \
target/wasm32-unknown-unknown/release/faunosteo_wasm.wasm
}
# WASM_BUILD_SHIPPED_ONLY=1 (the application image) builds pkg/ alone; the stamp needs node,
# absent from that stage, and only the test suites read it.
rm -rf packages/core-wasm/pkg
if [ "${WASM_BUILD_SHIPPED_ONLY:-0}" = 1 ]; then
build_module packages/core-wasm/pkg
else
stamp="$(node scripts/wasm-stamp.mjs)"
rm -rf packages/core-wasm/pkg-proofs
build_module packages/core-wasm/pkg-proofs --features proofs
echo "$stamp" > packages/core-wasm/pkg-proofs/BUILD_STAMP
build_module packages/core-wasm/pkg