Repository navigation
feat(contract): role watch and capability cmd.exchange - #1623
Conversation
ADR 0009 step 2: the shared registry copied byte for byte from srcfl/ftw-webapp, and the Go constants generated from it. The box claims neither name yet. DefaultCaps lists its capabilities by hand, so cmd.exchange stays unsaid until step 5. The role needs a guard: knownRole reads the generated table, so with watch in it the LAN page could mint a watch code, or change a phone into a watch, with no phone above it. appLinkRoleAllowed now refuses watch at both doors. Step 3 replaces that refusal with the real rule: over a session, from an owner, with step-up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 498f26c7f1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| RoleWatch: { | ||
| "ftw.live.read", | ||
| "ftw.plan.read", | ||
| "ftw.events.read", | ||
| "ftw.dispatch.write", |
There was a problem hiding this comment.
Reject persisted watches until parent authorization exists
After a site enrolls a watch on a later milestone and then uses ftw rollback with the current data, appenroll.load preserves the watch row and appuplink admits its key because the role is now known. ScopesForRole then grants the watch unconditional ftw.dispatch.write, without the parent intersection or cascading revocation required by ADR 0009, so a watch can continue controlling energy even after its phone is demoted or removed. Keep this role inadmissible at session construction until parent-aware authorization ships, not merely blocked at the pairing API.
Useful? React with 👍 / 👎.
Step 2 of ADR 0009.
contract/registry.yamlis copied byte for byte from srcfl/ftw-webapp#84, andgo generate ./internal/...addsRoleWatch, its scopes andCapCmdExchange:watch:ftw.live.read,ftw.plan.read,ftw.events.readandftw.dispatch.write.cmd.exchange: the box opens the relay's exchange socket and mints watch codes.The box claims neither name yet.
DefaultCaps()lists its capabilities by hand, socmd.exchangestays unsaid until step 5.knownRolereads the generatedRoleScopes. Withwatchin that table, the LAN page could mint a watch code or change a phone into a watch: a watch with no phone above it.appLinkRoleAllowednow refuseswatchat both doors with 403. Step 3 replaces that refusal with decision 4: over a session, from an owner, with step-up, bound to the calling phone.TestNoDoorHandsOutAWatchYetruns against the realappenroll.Identity. Without the guard, a scanned watch code from the LAN answers 200 with"role":"watch".Contract-pair: srcfl/ftw-webapp@feat/watch-registry
Paired pull requests. All three carry the same file, byte for byte.
Merge this one and srcfl/ftw-webapp#84 together: while both are open, each CI compares against the other's branch.
Tests
🤖 Generated with Claude Code