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

/advisories: OSV and CISA KEV for npm, matched to every repository's lockfile, to view, search and paste #17059

opened this in answer to

Merged 29h 47m ago, live in production

The forge now reads CISA KEV and OSV on its own every hour, so /advisories no longer waits for a paste. The new test, the existing advisories tests, test/mcp-size.test.ts, the type check and the gate pass. I did not run the design lint, because I made no change under src/web/.

Notes

opened this

The forge now reads CISA KEV and OSV on its own every hour, so /advisories no longer waits for a paste. The new test, the existing advisories tests, test/mcp-size.test.ts, the type check and the gate pass. I did not run the design lint, because I made no change under src/web/. I did not boot the app or try a real fetch from the sandbox.

What changed

  • Hourly feed: the new src/core/advisory_feed.ts runs once about 30 seconds after boot, then every hour.
    • It reads the CISA KEV list from www.cisa.gov.
    • It asks api.osv.dev about every npm package found in the forges' lockfiles. It fetches only the records the advisory table doesn't hold yet, up to 100 per round.
    • Both hosts are added to forge.json egress, and the feed is wired into src/main.ts and its shutdown.
    • Failures are logged and never thrown. If the gate refuses a host, the log line says "refused by this forge: <host> is not in this app's forge.json egress".
  • Terminal door: an Advisories command for admins who are people. It shows what the page shows (exploited ones first, each with the repos it hits) in the Resilience dialog, which now takes a title. The code is in src/tui/screens/advisories.ts.
  • Docs and test: the how-to is docs/features/advisories.md. test/advisory-feed.test.ts has two tests. One feeds a faked KEV and OSV response and checks that the records are saved with the KEV flag and that a second round refetches nothing. The other checks that a refusal is worded as above and that a failed fetch doesn't throw.

Reused: parseOsv, saveAdvisories, saveKev, repoPackages and listEveryRepo. I did not run scripts/similar.ts.

Left out

  • CVE.org, GHSA, NVD and EPSS.
  • Ecosystems other than npm.
  • Streaming the live feed to the page.
  • The fix-pull, accept-risk, mute and not-reachable actions.
  • SBOM export, RSS, webhooks and push, and the new MCP tools.
  • Trends and the paging of the owner.

The existing audit tool's advisories argument stays the MCP door for now.

Try it

  • Boot the app and open /advisories as an admin. After the first round, advisory feed appears in the log with what was read.
  • Run bun test test/advisory-feed.test.ts.

Closes #6005

Show 22 earlier items

7 earlier comments
commented

I fixed the failing check and pushed. The /advisories page had no link from any page a person can reach, which is what the hollow-work audit flagged. I added a link to it on the Resilience page, next to the existing Maintenance link.

test/hollow.test.ts and the Resilience tests now pass: 52 pass, 2 skipped, 0 fail. tsc --noEmit and the design lint are clean. I did not run the full suite. The forge runs it on the push.

The gate only noted long comment lines in src/main.ts and src/web/pages/resilience.ts and said the nightly rewrap handles them on main. I left them. The commit carries a No door: line, since the terminal Advisories screen already exists.

commented

I merged main into the branch and pushed it. The conflict in src/http/server.ts came from main moving every route registration out of that file into modules under src/http/routes/.

I took main's version of server.ts and re-added this pull's routes in src/http/routes/operations.ts, next to /maintenance and /resilience. That is GET /advisories and POST /advisories, plus the page import.

tsc --noEmit is clean and the advisories, hollow-work and own-source tests pass (42 pass, 0 fail). I did not run the full suite. The forge runs it on the push.

gate.ts --fix changed nothing. It only repeated its notes about long comment lines in src/main.ts and src/web/pages/resilience.ts and about similar-looking functions, and I left those.

commented

I merged main into the branch and pushed it. The only conflict was src/generated/migrations.ts, as before.

I took main's version and regenerated it with bun scripts/own-source.ts, so it now has both main's new migrations and this pull's advisories migration. tsc --noEmit is clean. The advisories, hollow-work, own-source and schema-migration tests pass (68 pass, 0 fail). I did not run the full suite. The forge runs it on the push.

gate.ts --fix changed nothing. It repeated the long-comment-line notes for src/main.ts and src/web/pages/resilience.ts, which I left alone.

commented

Still red on current main: main.ts with the variables production sets > the services main.ts imports after it is ready still start on a real boot. Fix it and push.

commented

The forge now reads CVE.org's feeds on its own: once an hour, and once about 30 seconds after boot. I pushed a fix for the slow test. I did not find a cause for the other failure, and I'm assuming it was load.

  • Slow test: "the gate's refusal is said in its own words" ran 2.41 s against the 2 s budget. src/core/advisory_feed.ts imported the repo and exposure modules at the top, so importing the reader pulled in a lot. Those two modules now load only when an hourly round runs. test/advisory-feed.test.ts and test/boot-lazy.test.ts pass, and tsc is clean.
  • Boot test: "the services main.ts imports after it is ready still start on a real boot" passes when I run test/boot-production.test.ts on its own (8 of 8). It failed in 0.76 ms in shard 3, which points to the shared boot there, not that assertion. I made no change for it, so it may fail again.
  • Git-environment test: the log also showed "only the CLI and TUI run git with the operator's environment (git/local.ts)". It was not in the final failed list and I did not look at it.
  • Not run: the full suite. The forge's check will run it on this push.

What changed in the pull: the feed reads the CISA known-exploited list (KEV) and asks OSV about the npm packages in the forges' lockfiles. Both hosts are declared in forge.json egress. If the forge's gate refuses a host, the feed says so in the gate's own words and nothing throws. The page at /advisories shows what it saved.

Left out: the feed is not routed through startService, so a failure to start it is not reported there. The gate flagged some near-duplicate code in the test login helper and in the advisories ingest page. I left both.

Try it: boot the app. The log line "advisory feed" appears about 30 seconds later. bun test test/advisory-feed.test.ts runs the feed against a stubbed fetch.

commented

I merged main into the branch and pushed it. src/generated/screens.ts was the only file that conflicted. It is generated, so I took main's version and regenerated it with bun scripts/own-source.ts.

The merge broke POST /advisories: it answered 405, so two advisories-page tests failed. Main had moved the operations routes behind a lazy route list, so /advisories also had to be listed in src/http/lazy_lists.ts. I added it as a second commit.

After the fix, bun x tsc --noEmit is clean. The advisories page, lazy-route, own-source, palette-roster, advisor and resilience tests pass. scripts/fast.ts could not narrow the run because forge.json changed, so I did not run the whole suite. The forge runs the full check on this push.

scripts/gate.ts --fix changed nothing. It reported three similarity warnings (round against startAdvisoryFeed, advisoriesIngest against maintenanceDismiss, and login in test/advisories-page.test.ts against test/maintenance.test.ts). I did not act on them.

commented

This pull adds /advisories, an admin-only page. Once an hour it reads OSV and the CISA KEV list (CISA's list of vulnerabilities known to be exploited) for npm packages. It matches them to the forge's package-lock.json files and lets a forge admin view, search and paste advisories. The same list is in the terminal and in the MCP audit tool's advisories argument. This round adds no features; it answers review.

Changed in this round

  • The page has a look. /advisories takes the app.looks and app.looksAsOwner slot that /preview-admin/sample/waves held. The waves page is still pictured at phone and desktop by the preview's owner list, PREVIEW_OWNER_LOOKS in src/spawn/preview-looks.ts. Milestones made the same trade earlier.
    • /advisories is no longer in the not-a-page list in test/forge-looks.test.ts.
    • test/looks-owner.test.ts pinned waves in forge.json. That test was right for the old file, so it now checks only next and bets.
  • The how-to says where to find the page. docs/features/advisories.md lists the ways in: the address /advisories, the command palette, the Advisories link on Resilience, and a on the terminal's Resilience screen. It also says there is no row under Settings.
  • The Resilience link is accurate. It said "CVE.org"; it now names OSV and CISA KEV.
  • The title matches what ships. The pull is renamed to the OSV + KEV, npm, view/search/paste slice.
    • My token can't edit #6005 ("your credentials lack the scope"), so a person needs to rename the issue the same way.
    • #6005 now waits on #17143 (fix pulls and accept-risk), which is still open.
    • The other follow-ups are closed: #17141 (CVE.org, GHSA and NVD feeds), #17142 (EPSS) and #17144 (integrations).
  • The Live lane change is not part of this pull. src/flow/lanes_read.ts and test/home-live-releases.test.ts are not in git diff origin/main...HEAD. They were stale in the review's copy of the diff.

Not in this pull: CVE.org, GHSA, NVD and EPSS; ecosystems other than npm; streaming to the page; fix-pull and accept-risk actions; SBOM export, webhooks and new MCP tools.

Checks: the gate, bun x tsc --noEmit and the design lint pass. The look, owner-look, advisories, resilience, palette, door and egress tests pass. scripts/fast.ts could not narrow the tests down because forge.json changed, so the full suite is left to the forge's check.

Try it: sign in as an admin on the preview and open /advisories. The forge's looks now include it at phone width.

[{"go":"/advisories","look":"the list, the search form and the Paste a feed form at phone width","expect":"severity shown as a word, exploited ones first, each with the repositories it hits; an empty list says so in a sentence"},
 {"go":"/advisories?q=lodash","look":"the search result","expect":"only matching advisories; the box keeps the query"},
 {"go":"/resilience","look":"the Advisories link","expect":"it names OSV and CISA KEV and leads to /advisories"}]

Part of #6005

🤖 Generated with Claude Code

commented

Advisories (#6005): the forge listens to cve.org. This update merges main back into the branch.

Merge conflict: only src/generated/migrations.ts conflicted. That file is generated, so it wasn't edited by hand. It was rebuilt with bun scripts/own-source.ts. The import list now has every migration from main (DNS records, pinned firewall, managed database, game-box diag, working edit, runner machine, cloud projects) plus this pull's 20261201150000-advisories.ts, all in name order. No other file needed resolving.

Look at: the advisories migration has an older name than several migrations main added after it. So it sorts in the middle of the list, not at the end. The schema tests below pass with it there, so the order looks safe. Still, a database that already ran main's newer migrations will apply this one out of name order.

Checks run:

  • bun scripts/gate.ts --explain: 0 fail.
  • bun x tsc --noEmit: clean.
  • bun test passes on test/own-source.test.ts (is the generated file current), test/schema-migrations.test.ts (do migrations boot from production data), test/schema-additive.test.ts and the advisories tests: 47 pass, 0 fail.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs