Skip to content

chore: add the OSS Scanner build and threat model - #22

Merged
Revinand merged 2 commits into
masterfrom
chore/oss-scanner
Oct 9, 2026
Merged

Revinand merged 2 commits into
masterfrom
chore/oss-scanner

Conversation

@SergeevDmitry

Copy link
Copy Markdown
Member

What

Adds .oss-scanner/, the two files Anthropic's OSS Scanner reads from an enrolled repository:

  • .oss-scanner/Dockerfile installs the Node 22 dependencies and the Foundry version CI pins (v1.7.1, checksum-verified), builds the package and runs npm test.
  • .oss-scanner/Dockerfile.dockerignore replaces the root .dockerignore for this build only (BuildKit's per-Dockerfile ignore file). The root file is written for the demo images and leaves out contracts/lib, the vendored forge-std the contract tests compile against. The demo images are unchanged.
  • .oss-scanner/threat_model.md summarizes SECURITY.md for the scanner: where untrusted input enters, which components matter, how we rate severity, and which documented behavior is not a finding.

Why

The scanner builds an enrolled project with network access, then audits it offline with Claude and emails findings, each with a reproducer and a proposed patch, to the security contact. Keeping both files in this repository, the option the scanner recommends, lets us change the build or the threat model without a pull request to anthropics/oss-scanner. The enrolment itself is a separate PR there that adds projects/agent-commerce/project.yaml pointing at these paths, opened after this one merges.

Review focus

  • Severity ratings in threat_model.md, "How we rate severity". The scanner uses them to rank its reports, so they should match how we would triage.
  • "Anything to leave alone", which mirrors SECURITY.md → "What the gateway does not protect against". Anything listed there will not be reported.

How it was tested

  • Official check. tools/check from anthropics/oss-scanner, run against this branch, clones the repo, builds .oss-scanner/Dockerfile and adds the scanner's layer. It finished with "agent-commerce builds.", and the tests during the build gave 115/115 files, 2359 passed and 6 skipped.
  • Offline. In the finished image with --network none, npm test gives the same result: 2359 passed, 6 skipped. The scanner can therefore run the suite offline. Anvil, forge-std and the solc download are all in the image.
  • Locally on macOS: npm run lint, tsc --noEmit and the changed test file pass.

Also in this PR

test(storage): skip the unwritable-store check when running as root. The "unwritable store" test relies on chmod 0444, which does not stop root from writing, so it failed in the scanner image, which runs as root. The startup checks for an unwritable database in the same file already skip as root or on Windows. This test now skips under the same condition and still runs as a normal user.

What it does not cover

  • It does not enrol the project. That happens in the anthropics/oss-scanner PR, which also sets the public primary_contact address.
  • .oss-scanner/ is not part of the npm package (files lists only dist, README.md and LICENSE), and nothing in CI or the demo stack uses it.

chmod does not stop root from writing, so under root the store stays
writable and the health check reports pass. The startup checks for an
unwritable database already skip as root or on Windows; this test now
skips under the same condition. It failed in containers that run the
suite as root, such as the OSS Scanner image.
Anthropic's OSS Scanner builds an enrolled project from a Dockerfile and
then audits it without network access. .oss-scanner/Dockerfile installs
the dependencies and the Foundry version CI uses, builds the package and
runs npm test. .oss-scanner/threat_model.md summarizes SECURITY.md for
the scanner: where untrusted input enters, which components matter, how
to rate severity, and which documented behavior is not a finding.
@Revinand Revinand self-assigned this Oct 9, 2026
@Revinand
Revinand merged commit aabd322 into master Oct 9, 2026
6 checks passed
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.

2 participants