Skip to content

Add OSS Scanner build image and threat model - #1626

Merged
erikhortsch merged 3 commits into
mainfrom
erik/oss-scanner
Nov 3, 2026
Merged

erikhortsch merged 3 commits into
mainfrom
erik/oss-scanner

Conversation

@erikhortsch

Copy link
Copy Markdown
Contributor

Adds .oss-scanner/Dockerfile and .oss-scanner/threat_model.md so this repo can be enrolled in Anthropic's OSS Scanner. Same layout as livekit/livekit#4995. Enrollment is a separate PR to anthropics/oss-scanner once these files are on main.

The threat model treats remote participants as untrusted and the server as untrusted for E2EE content, puts the unsafe/C++ FFI crates (webrtc-sys, yuv-sys, soxr-sys) first, treats the host app on the other side of livekit-ffi as trusted, and leaves libwebrtc internals out of scope unless LiveKit's patches or usage cause the bug.

Build notes:

  • The scanner clones without submodules, so the image runs git submodule update --init --recursive (libyuv, protocol).
  • libwebrtc is the prebuilt release asset webrtc-sys-build would download (tag read from its source), unpacked outside target/ and pointed to by LK_CUSTOM_WEBRTC.
  • clang 21 comes from .github/scripts/install-clang.sh; the unused parts of the LLVM release (flang, mlir, lldb, static archives) are deleted in the same layer, taking it from ~11 GB to ~1.4 GB.
  • Examples, tools/bindgens, the Node bindings, livekit-wakeword and livekit-capture aren't built.

Verification

  • docker build of this Dockerfile (arm64, podman): builds; the baseline cargo test over the 21 listed packages plus livekit-ffi --features core-modules passes (0 failures).
  • With --network none --cpus 2 --memory 8g, the threat model's test commands run offline without recompiling.
  • tools/check from anthropics/oss-scanner clones and builds this branch through the compile step, but my local 59 GB podman VM ran out of disk committing the test-binary layer. The scanner's build VM has 120 GB; not verified there.
  • The scanner runs x86-64; the libwebrtc and LLVM downloads are selected per arch and both x64 and arm64 assets exist.

🤖 Generated with Claude Code

- `webrtc-sys/src/*.cpp`: LiveKit's C++ bridge to libwebrtc, especially
`packet_trailer*.cpp`, `av1_bitstream.cpp`, `frame_cryptor.cpp`, and the
video and audio frame-buffer bridges.
- Unsafe Rust over frame buffers: `libwebrtc/src/native/video_frame.rs`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I would broaden this: anywhere the unsafe keyword is used should be audited, especially where there is no corresponding // SAFETY: ... comment explaining why the operation is safe.

participants.
- `livekit/src/room/e2ee/` and `livekit-datatrack/src/e2ee.rs`: key provider,
ratcheting, and encryption of media frames, data packets, and data tracks.
- `webrtc-sys/src/*.cpp`: LiveKit's C++ bridge to libwebrtc, especially

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: One point to clarify is there are fundamentally two FFI layers in this repo: Rust → client languages and Rust → libwebrtc. The first is well covered by this doc, but the second should be explicitly called out. Any code in the libwebrc or webrtc-sys crates is relevant in this second FFI layer and should be in scope for auditing.

@erikhortsch
erikhortsch marked this pull request as ready for review November 2, 2026 22:40
@erikhortsch
erikhortsch requested a review from a team November 2, 2026 22:40

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread .oss-scanner/Dockerfile
Comment on lines +15 to +16
# Build image for Anthropic's OSS Scanner. Keep the Rust version in step with rust-toolchain.toml.
FROM rust:1.97.1-bookworm

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Scanner enrollment has no changeset

This PR adds Dockerfile without a changeset. Repository guidance requires one for every PR, even when no crates need a bump.

Learn more

The repository guidance requires a changeset for every PR and asks it to list crates that need a version bump. This PR only adds scanner configuration, so no crate needs a bump. The PR diff contains no new changeset.

Example: A scanner-only PR adds these two files but nothing under .changeset/. It meets the version-bump check's exemption for non-crate changes, yet misses the repository's every-PR changeset rule.

Recommended fix: Add a knope-compatible changeset under .changeset/ with a single unwrapped prose summary and no crate bumps, or reconcile the repository guidance with the CI exemption for changes that do not affect versioned crates.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread .oss-scanner/threat_model.md Outdated
over WebRTC. `livekit-ffi` exposes the client to host languages in two ways: a
C ABI that takes protobuf requests (`room-apis`, used by the Python, Node, and
Unity SDKs) and UniFFI bindings (`core-modules`: data streams, data tracks,
signalling, and tokens, used from Swift and Kotlin).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Swift and Kotlin and also flutter. If there are any security issues with the dart bindgen / that whole workflow those would be great to raise as part of this as well

Suggested change
signalling, and tokens, used from Swift and Kotlin).
signalling, and tokens, used from Swift, Kotlin, very soon Flutter - the infrastructure in this repository is set up for flutter to consume the `core-modules` livekit-ffi build, and poking holes at this is definitely in scope).

@erikhortsch
erikhortsch merged commit 42c1060 into main Nov 3, 2026
35 of 36 checks passed
@erikhortsch
erikhortsch deleted the erik/oss-scanner branch November 3, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants