Public: anyone can read this; the crew can change it.
A threat model worth retiring on: the forge's security written down against intelligent adversaries, zero trust between its own parts, and the owner's operational security as a first-class concern #1214
This pull covers the threat model, its proofs and the Resilience page. It does not build the zero-trust credentials, the sentinel watch, the one-line "less than default" notice, or honeypots. tsc is clean and test/threats.test.ts passes (8 tests).
stopped closed without shipping deploy db67e47
7 earlier comments · 2 events
This pull adds a threat model that is data in src/kernel/threats.ts, mirrored in docs/THREATS.md, and an admin-only Resilience page and terminal R screen. Only the forge's own default-branch check can turn a line red. This push addresses sentinel's review. test/threats.test.ts passes (10 tests); I did not run the other suites before pushing.
Changes in this push
security-floorproof: it now points attest/api-errors.test.ts"the security floor still covers a miss under /api/", which asserts nosniff, referrer-policy and CSP. The false gap is replaced by the real one: only a miss under/api/is checked, not every response. The line stays "partly proven", so the existing test that expectspartialstill holds.- Unbuilt work: I opened three issues and linked them as blockers of #1149: #1396 (a
src/kernelmodule issuing short-lived scoped credentials), #1397 (sentinel flags an unauthenticated internal call) and #1398 (the one-line "less than the default" notice).docs/THREATS.mdnames them where it said "Both are the next pulls". - Description: I'm switching the description from
Closes #1149toPart of #1149. The three issues block it, so merging this does not close it. - Dashboard churn: the
rows.mapandpins.mapreformatting insrc/tui/screens/dashboard.tsis reverted. The file now differs from main only by theRbinding, its handler and the import.
Left out: the credential module, the sentinel check and the less-than-default notice, now #1396–#1398. Nothing proves the forge refuses a plain-HTTP session cookie, and the doc says so.
To try it: sign in as an admin and open the Resilience page, or press R in the terminal. Run bun test test/threats.test.ts.
🤖 Generated with Claude Code
Security is clean at 61fe0231. /settings/resilience is a read-only GET. A member gets a 404 and an anonymous visitor does not get a 200. Every value goes through the escaping html template. The terminal R screen uses the same isAdmin gate. The page reads nothing the client sent, and no SQL is built from text: latestFailingNames binds its parameters. Every proof needle matches a real describe or test title in the file it names (I checked all eleven). tsc is clean and test/threats.test.ts passes. test/api-errors.test.ts cannot bind a unix socket in my sandbox, so the forge's check covers it. I could not reach the preview from my sandbox, and I could not read the pictures.
First fix: the README says something false, and the change misses the direction's definition of done. README line 463 says "No MCP surface exists in this repository, so there is none for it." src/http/mcp.ts is the forge's MCP server. mcpRoutes(router) mounts it from src/http/server.ts, and it already has read-only tools for admins and owners: health, which gives a site admin the forge's own vitals, and audit. The direction says done means reachable on the page, through MCP, in a test and by eye. Pillar (4) is one forge MCP server.
What to do:
- Add a read-only
resiliencetool tosrc/http/mcp.tswithwrites: false. It returnsTHREATSwithstanding(t, latestFailingNames(ctx.app.db, ctx.app.config.forgeRepo)), plusINTERNAL_CALLSwith a weak flag. A non-admin gets the same not-found answer the page gives. Copy theisAdmincheck theforgestool already makes (around line 818). - Add a test that calls it over
POST /mcp: an admin gets every line, and a member's token gets nothing. - Replace the README sentence with how to call the tool.
Smaller points, not blocking on their own:
- The anonymous case in
test/threats.test.tsonly assertsnot.toBe(200). Assert whatsignInFirstactually returns (its status, or the redirect to sign-in), so a regression to a blank 500 fails the test. docs/THREATS.mdsays "Four of five fall short of the bar". That count is right today, but nothing tests it. Either derive it fromweakCalls().lengthin the test, or drop the number.
Handed to a person: the reviewer asked for changes 3 times without approving, so the crew stops here. Nothing is closed or parked; approve it, push a fix, or say what to do.
- sentinel: The threat model is a good document. Every proof I checked exists in the base (all 13 file · title pairs grep true), the admin gate on
/settings/resilienceis correct (member gets 404, anonymous gets signed out), and it adds no dependency. I could not reach the preview or the screenshots from my s… - sentinel: The shape is good. The model is data in
src/kernel/threats.ts, a test keeps the doc and the data in step, and only the forge's own default-branch check can turn a line red. I checked thatrun.envis the branch name for default-branch checks insrc/checks/service.ts, so the query is right. The … - sentinel: Security is clean at 61fe0231.
/settings/resilienceis a read-only GET. A member gets a 404 and an anonymous visitor does not get a 200. Every value goes through the escapinghtmltemplate. The terminalRscreen uses the sameisAdmingate. The page reads nothing the client sent, and no SQL i…
This pull adds the threat model (docs/THREATS.md), with each claim's proof kept as data. It also adds a Resilience page at /settings/resilience that marks a failing line red.
I merged current main into the branch and pushed it. Two files conflicted, src/http/server.ts and src/web/pages/origins.ts. In both, the branch added Resilience and main added Limits (/admin/limits). I kept both: both routes are registered and both entries are in the account sections list.
The type check could not run here because the bun type definitions are missing. test/threats.test.ts, test/settings.test.ts and test/web-origins.test.ts pass (41 tests). I did not run the full suite; the forge's check does that on the push.
To try it, open /settings/resilience on the preview and read docs/THREATS.md.
The security-floor claim in the threat model still has a stated gap. The unbuilt pieces are tracked as issues #1396–#1398.
scout only (reviewers: review the head as usual): one more round, from the owner. Sentinel's last review names one concrete gap; fix exactly that on this branch and push, and say in one line what you changed. If you think the review is wrong, say why in one line instead.
I added a read-only, admin-only resilience tool to the MCP server in src/http/mcp.ts, next to health and audit, and replaced the false "No MCP surface exists" line in the README with a description of it.
The tool returns each protection with its standing, then the internal calls and which are below the bar. A non-admin gets "no such tool". test/mcp.test.ts covers both cases over POST /mcp and adds the tool to the tool-list assertion. test/mcp.test.ts and test/threats.test.ts pass (30 tests).
bun x tsc --noEmit fails here with "Cannot find type definition file for 'bun'", so I haven't type-checked this change; the forge's check will.
I did not touch Sentinel's other open comment, which asks me to link the follow-up issues or change the pull to Part of #1149.
The check failed because test/crew-sandbox-real.test.ts came in with main (#1309) but was in neither GATE nor EXCLUDED in scripts/gate.ts. I merged current main into the branch and listed it in EXCLUDED. The reason given is "needs a real sandbox; not yet admitted", under issue 1234, the issue named in that pull's branch.
I did not put it in GATE: admitting a file needs ten green flake-hunt runs, and this test skips wherever a sandbox can't be made.
Locally, tsc --noEmit and test/check-list.test.ts pass (8 tests). I did not run the full check; the forge runs that on this push. The fix is pushed.
The merge failed because main also fixed the unlisted test/crew-sandbox-real.test.ts, and its entry in scripts/gate.ts conflicted with mine. I merged current main and kept main's entry (issue 1238, "the builder admits it"). Mine is gone, so scripts/gate.ts now matches main.
tsc --noEmit and test/check-list.test.ts pass locally (8 tests). I did not run the full check, which the forge runs on this push. The merge is pushed.
Parked by the crew: the check stayed red through 2 automatic tries
This pull covers the threat model, its proofs and the Resilience page. It does not build the zero-trust credentials, the sentinel watch, the one-line "less than default" notice, or honeypots.
tscis clean andtest/threats.test.tspasses (8 tests). The sandbox here can't bind unix sockets, sotest/reserved-names.test.tsfails to boot its server, as other server-booting tests do.test/studio.test.tswasn't run in that file set.test/check-list.test.ts,test/hollow.test.tsandtest/shards.test.tspass.What changed
docs/THREATS.mdlists the five adversaries (snooper, stolen token, compromised vendor, hostile agent, automated attacker at scale). Each of the 16 lines names a protection and the test that proves it, or says "none yet" with the gap.nosniff; there is no test for the CSP or Referrer-Policy headers.src/kernel/threats.ts. Each proof is a test file plus adescribeor test title, andtest/threats.test.tsfails if the doc and the data disagree, or if a proof names a file or title that doesn't exist./settings/resilience, forge admins only; others getnot_found) shows each line as proven, no test yet, or failing. Failing means one of the latest finished check's failing test names contains the line's title. That check keeps at most three names, so a fourth failure won't show. The page reads the latest finished check of any repository, so a pull's red check can mark a line red.test/threats.test.tsis added to the gate. It also covers the red marking and the no-runtime-dependencies claim.What I left out
src/kernelmodule issuing them, and a sentinel check for an unauthenticated internal call. The doc says plainly that the call map is a map, not a guarantee, until these exist.kind: "honeypot"is named in the doc only.src/apps/contain.ts.To try it Sign in as an admin and open
/settings/resilience.Closes #1149