Public: anyone can read this; the crew can change it.
The Apple app can read the game door, lock it and open a write window, through one JSON route #18341
Merged 58m ago, live in production
I added /api/v1/games/ /door for the Apple app (src/http/api/gamedoor.ts). bun test test/game-door-api.test.ts passes (5 tests), tsc --noEmit is clean, and bun scripts/gate.ts raised only two points, which I answered or flagged below. I did not run the whole suite; the forge's check will.
-
Reviews
ApprovedClean. I tried to break it and could not. Owner gate: a non-owner, an unknown box and an anonymous caller all get 404 or 401, and the box is resolved through roleOn and mayDo(owner), the same check as the page. Scope: GET needs ro and POST needs rw. A cookie POST goes through requireScope's cross-origin check, and the test covers it. Body: it is read with the bounded body() helper, and each proof field is capped at 8192 bytes and must be a string. Open: it goes through the same passkeyProves call as the page. The challenge is single-use, tied to the user, and the key must be the caller's own. A second use of a challenge, a forged signature, and an empty or missing challenge all give 403 with the door unchanged. Challenge flooding is already limited per owner by the challenges() store. rpId and origin are taken from the request URL exactly as the page does. A bad op gives 422. Audit: neither lockDoor nor openWindow nor the page's handler writes an audit row, so none here matches the page. Both doors: the terminal's box screen already locks and opens, and the how-to is in docs/features/game-box.md, not the README. Tests cover owner lock, non-owner 404, open without proof, open with a real ES256 proof for WINDOW_MINUTES, replay, and the cross-origin cookie. I did not exercise the preview.
-
Checks
shipped production is serving it deploy b6d2692
-
History
- Game door route: OpenAPI rows and the seed's unseeded note (#18337) 303d0b8
- Page budget: the game door route has no fixture, listed in a file of its own dbe0d59
- Try: curl -H 'authorization: Bearer <write token of a box owner>' <preview>/api/v1/games/<box>/door, then POST {"op":"lock"} 8425a87
- Apple app: read, lock and open the game door through one JSON route (#18337) fcf9c41
- Game door: lock automatically when the player leaves the network, as a setting (#18329) f698c54
- Connections: email_check.verified_at is read nowhere once #18222 lands, and is dropped when no release in play reads it (#18327) 0ccd5dd
- Connections: one place says an email is proven, with the sign-in proof reading it (#18320) 181d662
- Talk opens on the conversation the person was in, at the place they left it (#18322) 3eab8eb
- Universal runner: a Mac registers itself, ships TestFlight from main with the forge's secrets, and has one switch (#18291) 08c168a
- Game door: the desk snapshot carries each player's allowed servers, from whoMayReach (#18325) 9b34956
- Connections 1: one list of proven identities on the account, with the proven email and the Minecraft link moved into it (#18168) 278b2e3
- Game door: one Talk engine for game chat, web and iOS (#18316) 8304196
- Game door: a read-only switch and a one-hour write window the owner opens with a second factor (#18304) 1235063
- Full suite red: 2 files in check run 01m91f4z6qq7gd3712hjm33z1r (#18315) 1f9f7ad
- Tab forge: serve the forge as the tab's own page in the hosted shell, no frame (#18306) d162615
- Connections: a Minecraft name is a second kind of proven connection beside email (#18227) 5948687
- Access 5c: the tab forge and the Apple app's on-device mode present the same visitor to a shared forge, so apps made without a login arrive owned (#18275) ec352f4
- Tab forge: making an app is refused ("not from this forge's own page") (#18267) b869757
- The release was held: could not cut the tag v0.7.741 (#18299) 4d3523d
- Tab forge: a real-browser walk makes an app and edits a file without 'Failed to fetch' (#18307) c343cd7
2 earlier comments
I added /api/v1/games/<box>/door for the Apple app (src/http/api/game_door.ts). bun test test/game-door-api.test.ts passes (5 tests), tsc --noEmit is clean, and bun scripts/gate.ts raised only two points, which I answered or flagged below. I did not run the whole suite; the forge's check will. I did not exercise the route against a running preview.
- Read:
GETreturns the door state and the page's words for it. It needs a read token. - Lock:
POST {op:"lock"}callslockDoor. It needs a write token, and a cookie post must be same-origin. - Open:
POST {op:"open", challenge, id, clientDataJSON, authenticatorData, signature}callsopenWindowonly whenpasskeyProvesaccepts the answer. Otherwise it returns 403 "Opening a write window needs a passkey of yours, signed just now. The game door stays as it was." - Challenge (my addition): the app needs a challenge before it can sign one.
POST {op:"challenge"}returns the challenge,allowandrpId, the same as the page's/door/options. - Access: the owner check is
roleOnandmayDo(…, "owner"), so forge admins count as owners and anyone else gets 404. No new grant. - Reused:
doorOf,doorWords,lockDoor,openWindow,proofChallenge,passkeyProvesandPROOF_FIELDS. Nothing was edited insrc/web/pages/games_door.ts. - Audit: the page writes no audit row for lock or open, so this route writes none either, which matches the page.
- Route table: I regenerated
src/http/lazy_lists.tsbecause the API router is a lazy family. - Tests:
test/game-door-api.test.tscovers owner lock, non-owner 404 on GET and POST, a bad op (422), a cross-origin cookie post (403), open without proof (403), and open with a real ES256 proof. The proof test opens forWINDOW_MINUTES, lifts a lock, and shows a replayed challenge is refused. - Terminal door: none added. The terminal already locks the door with
w. The commit saysNo door:, and I added a section todocs/features/game-box.md. - Gate: the pre-push rule wanted a "Try:" line, so I added one in an empty commit. It also flagged my test's user helper as 0.91 similar to the one in
test/ask-settles.test.ts. I left that alone and the push went through. - Left out: setting the window length and lock-on-leave stay on the page and in the terminal.
Try it: make a write token at /settings/tokens for a box owner, then curl -H "authorization: Bearer $T" <preview>/api/v1/games/<box>/door. Then POST with {"op":"lock"}.
[{"go":"GET /api/v1/games/<box>/door with an owner's token","look":"JSON with state, minutes and words","expect":"200 for the owner, 404 for anyone else"},{"go":"POST {\"op\":\"open\"} with no passkey fields","look":"the error body","expect":"403 saying a passkey signed just now is needed"}]The Apple app can now read the game door, lock it and open a write window through /api/v1/games/<box>/door. The check failed on the new route because the page-budget test wants every route it can't fill with a fixture listed in its own file. I added test/budgets/unfixtured/api-v1-games-box-door.json, and test/pages-budget.test.ts and test/page-budget-files.test.ts pass again. I haven't re-run the full check; the forge will on this push.
- Read:
GETreturns the door state and the page's words for it. It needs a read token. - Lock:
POST {op:"lock"}locks the door. It needs a write token, and a cookie post must be same-origin. - Open:
POST {op:"open", challenge, id, clientDataJSON, authenticatorData, signature}opens a window of the box's length only when one of the owner's passkeys signed the challenge just now. Otherwise it returns 403 in plain words and the door stays as it was. - Challenge: I added
POST {op:"challenge"}, which returns the challenge,allowandrpId. The app needs it to get something to sign. This goes beyond the issue's list. - Access: only the box's owner can use it (forge admins own every box); anyone else gets 404. No new grant.
- Audit: the web page writes no audit row for lock or open, so this route writes none either.
- Reused:
doorOf,doorWords,lockDoor,openWindow,proofChallenge,passkeyProvesandPROOF_FIELDS.src/web/pages/games_door.tsis untouched. - Left out: setting the window length and lock-on-leave stay on the page and in the terminal. There is no new terminal screen, because
won the box screen already locks the door. The how-to is indocs/features/game-box.md.
Try it: make a write token at /settings/tokens for a box owner, then curl -H "authorization: Bearer $T" <preview>/api/v1/games/<box>/door. Then POST {"op":"lock"}.
[{"go":"GET /api/v1/games/<box>/door with an owner's token","look":"JSON with state, minutes and words","expect":"200 for the owner, 404 for anyone else"},{"go":"POST {\"op\":\"open\"} with no passkey fields","look":"the error body","expect":"403 saying a passkey signed just now is needed"}]The Apple app can now read, lock and open the game door through one JSON route, /api/v1/games/:box/door. This push fixes the two failures that were mine. The check's third failure, the "N+1" test, passed on my rerun and I changed nothing for it, so I can't say what caused it.
What the check was failing on
- OpenAPI: the new route had no row. I added
getApiV1GamesBoxDoor.tsandpostApiV1GamesBoxDoor.tsundersrc/contract/openapi/routes/and regenerated the index. - Security floor: the test's list of routes the seed can't fill didn't name the route. I added
/api/v1/games/:box/doorwith its reason: it needs a game box owned by the signed-in person, and the seed has none. - N+1: the "a pull's crew activity does not cost more as its agent runs grow" test passed on my rerun.
Checks run locally
- The security-floor, surfaces-adversarial, openapi-covers-routes, openapi-routes and game-door-api tests pass (642 pass, 0 fail).
tscis clean.gate --fixchanged nothing. It did print one similarity hint:mkintest/game-door-api.test.tslooks likepersonintest/ask-settles.test.ts. I left it.
Left out: the page and terminal sides of the door already existed. The commit says No door: and the how-to is already in game-box.md.
To try it: curl -H 'authorization: Bearer <write token of a box owner>' <preview>/api/v1/games/<box>/door, then POST {"op":"lock"}.
I added
/api/v1/games/<box>/doorfor the Apple app (src/http/api/game_door.ts).bun test test/game-door-api.test.tspasses (5 tests),tsc --noEmitis clean, andbun scripts/gate.tsraised only two points, which I answered or flagged below. I did not run the whole suite; the forge's check will. I did not exercise the route against a running preview.GETreturns the door state and the page's words for it. It needs a read token.POST {op:"lock"}callslockDoor. It needs a write token, and a cookie post must be same-origin.POST {op:"open", challenge, id, clientDataJSON, authenticatorData, signature}callsopenWindowonly whenpasskeyProvesaccepts the answer. Otherwise it returns 403 "Opening a write window needs a passkey of yours, signed just now. The game door stays as it was."POST {op:"challenge"}returns the challenge,allowandrpId, the same as the page's/door/options.roleOnandmayDo(…, "owner"), so forge admins count as owners and anyone else gets 404. No new grant.doorOf,doorWords,lockDoor,openWindow,proofChallenge,passkeyProvesandPROOF_FIELDS. Nothing was edited insrc/web/pages/games_door.ts.src/http/lazy_lists.tsbecause the API router is a lazy family.test/game-door-api.test.tscovers owner lock, non-owner 404 on GET and POST, a bad op (422), a cross-origin cookie post (403), open without proof (403), and open with a real ES256 proof. The proof test opens forWINDOW_MINUTES, lifts a lock, and shows a replayed challenge is refused.w. The commit saysNo door:, and I added a section todocs/features/game-box.md.test/ask-settles.test.ts. I left that alone and the push went through.Try it: make a write token at
/settings/tokensfor a box owner, thencurl -H "authorization: Bearer $T" <preview>/api/v1/games/<box>/door. ThenPOSTwith{"op":"lock"}.Closes #18337