Skip to content

Bridge S3: per-agent fleet credentials + bootstrap enroll tokens (#14368) - #14407

Merged
developing-today-fleet[bot] merged 1 commit into
mainfrom
felix/14368-bridge-credentials
Nov 24, 2026
Merged

developing-today-fleet[bot] merged 1 commit into
mainfrom
felix/14368-bridge-credentials

Conversation

@dezren39

@dezren39 dezren39 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Implements bridge build-out slice S3 (design §4.5, trust resolutions §5.1–3): the fleet surface gains per-agent credentials and bootstrap enrollment, on the notes surface's hash-only model.

What changed (pkgs/message-bridge/worker):

  • fleet_credential (token_hash PK, agent, scopes, created, revoked_at) — SHA-256 hashes only. A /fleet/<credential>/... request acts only as its own agent: hello/inbox/ack for its own name (scope inbox), send with from_addr fixed to agent:<its name> and the sender label forced to match (scope send). Every refusal is the plain 404 a wrong token gets.
  • enroll_token (token_hash PK, agent, kind, groups, notes_identity, expires_at, used_at, revoked_at, created) — POST /api/<owner>/enroll-tokens mints a single-use, expiring bootstrap token bound at mint time to the agent name, kind and groups; the value is returned once in that response and never stored.
  • POST /enroll/exchange {bootstrap_token, agent} — one atomic claim (name match + unused + unrevoked + unexpired) burns the token, registers the fleet mailbox with the bound groups and, when minted with one, the class/name notes identity; mints the fleet credential and notes token and returns their values once. Any failure is a plain 404.
  • Revocation: POST /api/<owner>/fleet/credentials/revoke {agent}, POST /api/<owner>/notes-tokens/revoke {identity}, POST /api/<owner>/enroll-tokens/revoke {bootstrap_token | token_hash} (unused tokens only).
  • The shared fleet token keeps working unchanged; no existing route is removed or weakened. enroll joins the reserved signal classes so the exchange path can't be shadowed by the public wake signal.
  • Durable Object methods + MemoryStore mirrors for every new store op; router inventory comment updated.

Tests — new test/credentials.test.mjs (6 tests), following the notes/fleet patterns: exchange provisions working fleet + notes credentials exactly once; a credential is refused (404) for another agent's inbox/hello/ack/send and cannot forge a sender (a send claiming sender: drew is stamped agent:<its name>); scopes gate routes; revocation of a fleet credential and of a notes token stops them immediately while other agents and the shared token are unaffected; bootstrap tokens expire, can be revoked while unused, and a used token can't be revoked; a sql-level test asserts hash-only storage (stored hashes equal the SHA-256 of the values; no value appears in any stored row) and the claim predicate.

Verification (remote): run 45406245992 reached the target HEAD (889ddc8) but died with node: command not found — the known executor-image gap (code#14267 / dezren39/fleet#111), recorded here rather than skipped. Re-dispatched with node provided by nix (run 45407524524, Target HEAD 889ddc8, node v22.23.5): 78 tests, 78 pass, 0 fail — the full worker suite, with the six new tests passing by name (ok 29–34).

Acceptance: all five criteria on #14368 are covered by the named tests above.

Left unmerged for Felix's review (security diff).

Closes #14368


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

fleet_credential and enroll_token tables store SHA-256 hashes only.
A /fleet credential acts only as its own agent (inbox scope:
hello/inbox/ack for its own name; send scope: from_addr fixed to
agent:<its name>); every refusal is the plain 404. Owner routes mint
single-use, expiring, name/kind/groups-bound bootstrap tokens and
revoke fleet credentials, notes tokens and unused bootstrap tokens.
POST /enroll/exchange burns the token, registers the mailbox (and the
notes identity when minted with one) and returns the agent's fleet
credential and notes token once. The shared fleet token is unchanged.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c485028e-be0c-4e6a-96e2-ba3b43ff08bb
Commits

Reviewing files that changed from the base of the PR and between ee91ecc and 889ddc8.

Files selected for processing: 6

  • pkgs/message-bridge/worker/src/fleet.js
  • pkgs/message-bridge/worker/src/index.js
  • pkgs/message-bridge/worker/src/messages.js
  • pkgs/message-bridge/worker/src/notes.js
  • pkgs/message-bridge/worker/src/routes.js
  • pkgs/message-bridge/worker/test/credentials.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bridge build-out S3 — per-agent fleet credentials + bootstrap enroll tokens (worker)

1 participant