From f20b081bc1f05695ec23ca2615f7421b7551fd26 Mon Sep 17 00:00:00 2001 From: Matthew Gregan Date: Wed, 25 Nov 2026 10:48:50 +1300 Subject: [PATCH] Add OSS Scanner build and threat model --- .oss-scanner/Dockerfile | 15 +++++++++++++++ .oss-scanner/threat_model.md | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .oss-scanner/Dockerfile create mode 100644 .oss-scanner/threat_model.md diff --git a/.oss-scanner/Dockerfile b/.oss-scanner/Dockerfile new file mode 100644 index 00000000..5a5baede --- /dev/null +++ b/.oss-scanner/Dockerfile @@ -0,0 +1,15 @@ +FROM rust:1-trixie + +WORKDIR /src +COPY . /src + +# The scanner clones without submodules. The AVIF tests need both fixture sets. +# cargo fetch also creates the workspace lockfile in a fresh checkout. +RUN git submodule update --init --recursive \ + && cargo fetch + +# The scanner runs offline. Check both the default and Firefox feature sets. +ENV CARGO_NET_OFFLINE=true +RUN --network=none cargo build --workspace --locked \ + && cargo test --workspace --locked \ + && cargo test --workspace --locked --features missing-pixi-permitted diff --git a/.oss-scanner/threat_model.md b/.oss-scanner/threat_model.md new file mode 100644 index 00000000..1d468716 --- /dev/null +++ b/.oss-scanner/threat_model.md @@ -0,0 +1,23 @@ +# mp4parse-rust threat model + +Firefox uses `mp4parse_capi` to read metadata from MP4 and AVIF files. +Web content can supply the entire file. Treat its bytes, including container +sizes, offsets, counts, and metadata, as untrusted. + +## Scope + +- Review the Rust MP4 and AVIF parsers (`read_mp4` and `read_avif`) and the C API + (`mp4parse_new` and `mp4parse_avif_new`), including how the C API exposes + parsed metadata and sample tables to its callers. +- Include the default configuration and `missing-pixi-permitted`, which Firefox + enables. Treat C callers and their callbacks as trusted and assume they meet + the documented pointer and lifetime contracts. +- Firefox integration code, downstream decoders, and the test fixture + submodules are outside this repository's review scope. + +## Security impact + +Prioritize memory safety and violations of the C API's documented guarantees +that malicious media can trigger. Consider crashes and disproportionate CPU or +memory use when they affect a realistic consumer. Rejecting malformed media +with a parse error is expected behavior.