Public: anyone can read this; the crew can change it.

Security against 24/7 agent swarms: OSV dependency scans with auto-fix pulls, secret scanning at push, code scanning in review, an exposure map with rate limits, a scheduled red team #6012

Parked opened this in answer to
Closed without merging

This pull covers only the data layer for the dependency scan (step 1 of #6004). The rest of the issue is not built. bun test test/security-osv.test.ts passes and tsc --noEmit is clean.

Notes

stopped parked by the crew deploy 76e6dd5

opened this

This pull covers only the data layer for the dependency scan (step 1 of #6004). The rest of the issue is not built. bun test test/security-osv.test.ts passes and tsc --noEmit is clean. I did not run bun test across the whole suite, and I have not seen the forge's check result yet.

What changed

  • GET /api/v1/repos/:owner/:name/security[?ref=] reads the repo's bun.lock and package-lock.json files (nested ones included) at a ref and returns packages, lockfiles and findings. It uses the same read access as the contents API, and an unknown or unreadable repo answers 404.
  • src/security/ holds three small modules:
    • lockfile.ts parses the two lockfile formats.
    • osv.ts loads OSV advisories and matches pinned versions against them. Each finding names the advisory, its severity and the smallest fixed version. Findings are sorted most severe first.
    • scan.ts reads the lockfiles from git and runs the match.
  • The advisories are *.json files in OSV format under $FORGE_APP_DATA/osv/. A missing directory counts as an empty mirror.
  • No new dependency. test/security-osv.test.ts covers the lockfile parsing, the version matching, and the route end to end. The README has a short section on it.

Left out

  • Hourly refresh of the mirror from OSV.dev.
  • Scanning on push and nightly.
  • Automatic fix pulls.
  • A security tab or forge-wide page. Nothing in the web UI or the MCP calls the route yet, so under the issue's "done means reachable" bar this is not done until those exist.
  • uv.lock, other ecosystems, and version ordering for non-semver schemes.
  • Steps 2–6 of the issue: secrets, code scanning, the exposure map and rate limits, the scheduled red team, and the posture page.

Try it Drop an OSV JSON advisory in $FORGE_APP_DATA/osv/, commit a bun.lock that pins an affected version, then request /api/v1/repos/<owner>/<repo>/security.

Closes #6004

4 earlier comments
commented

This pull covers only the data layer for the dependency scan (step 1 of #6004). The rest of the issue is not built. bun test test/security-osv.test.ts passes and tsc --noEmit is clean. I did not run bun test across the whole suite, and I have not seen the forge's check result yet.

What changed

  • GET /api/v1/repos/:owner/:name/security[?ref=] reads the repo's bun.lock and package-lock.json files (nested ones included) at a ref and returns packages, lockfiles and findings. It uses the same read access as the contents API, and an unknown or unreadable repo answers 404.
  • src/security/ holds three small modules:
    • lockfile.ts parses the two lockfile formats.
    • osv.ts loads OSV advisories and matches pinned versions against them. Each finding names the advisory, its severity and the smallest fixed version. Findings are sorted most severe first.
    • scan.ts reads the lockfiles from git and runs the match.
  • The advisories are *.json files in OSV format under $FORGE_APP_DATA/osv/. A missing directory counts as an empty mirror.
  • No new dependency. test/security-osv.test.ts covers the lockfile parsing, the version matching, and the route end to end. The README has a short section on it.

Left out

  • Hourly refresh of the mirror from OSV.dev.
  • Scanning on push and nightly.
  • Automatic fix pulls.
  • A security tab or forge-wide page. Nothing in the web UI or the MCP calls the route yet, so under the issue's "done means reachable" bar this is not done until those exist.
  • uv.lock, other ecosystems, and version ordering for non-semver schemes.
  • Steps 2–6 of the issue: secrets, code scanning, the exposure map and rate limits, the scheduled red team, and the posture page.

Try it Drop an OSV JSON advisory in $FORGE_APP_DATA/osv/, commit a bun.lock that pins an affected version, then request /api/v1/repos/<owner>/<repo>/security.

commented

The only new message on #6004 is an automatic triage note: no pillar is named, so the issue waits behind the Later gate. Naming a pillar is a planning decision for a person, so I changed nothing and pushed nothing. The branch still holds the one slice I pushed earlier.

What the pull contains

  • GET /api/v1/repos/:owner/:name/security[?ref=] is the data layer for the OSV dependency scan (step 1 of #6004).
  • The route reads bun.lock and package-lock.json at a ref and matches the pinned versions against OSV advisories. Each finding names the advisory, its severity and the smallest fixed version, and findings are sorted most severe first.
  • The advisories come from *.json files under $FORGE_APP_DATA/osv/. A missing directory counts as an empty mirror.
  • The route uses the same read access as the contents API. An unknown or unreadable repo answers 404.
  • No dependency was added. The code is in src/security/, the tests are in test/security-osv.test.ts, and the README has a short section.
  • bun test test/security-osv.test.ts passes and tsc --noEmit is clean. I have not seen the forge's check result.

Left out

  • Hourly refresh of the mirror from OSV.dev.
  • Scanning on push and nightly.
  • Automatic fix pulls.
  • The per-repo security tab and the forge-wide page.
  • uv.lock and other ecosystems.
  • Steps 2–6 of the issue: secret scanning, code scanning, the exposure map and rate limits, the red-team lane, and the posture page.

Under the issue's "done means reachable" rule, nothing in the web UI or the MCP calls the route yet, so this slice is not done.

To try it Put an OSV JSON advisory in $FORGE_APP_DATA/osv/, commit a bun.lock that pins an affected version, then request /api/v1/repos/<owner>/<repo>/security.

To move the issue Someone needs to name a pillar on #6004. The remaining steps are each too big for one run and should be split into linked child issues.

commented

I merged main into the branch and pushed it. The merge should now apply cleanly. I haven't seen the forge's check result on the new push.

  • Conflict: it was only in README.md, where main and this branch had each added a section at the end. I kept both and moved "Dependency scan (OSV)" to the end of the file so it doesn't sit under main's "Child quota" heading. src/http/api.ts merged without conflict.
  • Checks run: tsc --noEmit is clean and test/security-osv.test.ts passes (6 tests). I didn't run the full bun test suite.
  • Scope: the pull is unchanged: the GET /api/v1/repos/:owner/:name/security route and the src/security/ modules from before. Everything left out in the earlier description is still left out.
commented

I merged main into this branch and pushed it. The only conflict was in README.md, where I kept both sides: the "Dependency scan (OSV)" section from this branch and the "Seeing the direction a vision pull will write" section from main. src/http/api.ts merged on its own.

I did not see a full bun test run finish. The run took longer than the command timeout and went to the background, and I pushed without waiting for it. These suites passed (12 tests, 0 failures):

  • test/security-osv.test.ts
  • test/mcp-vision.test.ts
  • test/security-floor-routes.test.ts

The type check (bun x tsc --noEmit) was in the same backgrounded command. Its output was empty when I last looked, so I never saw it finish either. The forge's check on this push will give the full verdict.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs