feat(core): key gateway trust and dm:send admission on user principals - #190
Merged
Merged
Conversation
…device Adds a second, parallel allowlist for principal device-ids alongside the existing bare-device set: addPrincipal/removePrincipal/listPrincipals/ isTrustedPrincipal manage it, and isTrustedFor decides trust from a caller-supplied, already chain-verified bearer and root-issuer pair, accepting either a directly trusted device or a bearer rooted at a trusted principal. hasAny now also reflects a trusted principal for the outbound gossip gate. The existing isTrusted/add/remove/list bare-device path is unchanged, so a peer with no principal at all behaves exactly as before.
admitAgentForDm now takes an optional delegationsRemaining argument, defaulting to 0 so the existing non-delegable bare-device path is unchanged. A positive value mints a dm:send grant naming a user principal as bearer, with enough delegation depth for that principal to mint further dm:send tokens to its own devices (agent-comms#187), the dm:send counterpart to how #161's device-membership tokens already let a principal admit its own devices. verifyDmSendToken needs no change: its chain-walk already resolves rootIssuer through any number of hops. wireTestTransport gains an optional userIdentityOptions parameter so a test can control (and therefore know ahead of time) a MeshStore's own user-principal identity, needed to construct a delegation whose scope narrows the grant it chains from.
…own device Adds delegateDmSendToDevice, the dm:send counterpart to device-membership.ts's admitDevice: given a dm:send grant a user principal was itself admitted with (delegationsRemaining > 0), mints a child token naming one of that principal's own devices as bearer, keeping the original admitting principal's own scope unchanged. mintCapabilityToken's own parent-narrowing refuses the mint if the parent has no delegation depth left or if the caller's identity is not the parent's own bearer. Records the delegated token-id under the delegating principal's own issued-grant store, keyed by device hex, mirroring how admitAgentForDm records its own root-level grants. This is the first real use of mintCapabilityToken's parent-narrowing machinery in this codebase; every existing grant is an independent root-level token.
…d dm:send token End-to-end integration test tying together the admitAgentForDm delegation depth and delegateDmSendToDevice primitives: an admitting user trusts a remote user principal rather than one bare device, that principal delegates the resulting grant to one of its own devices out of band, and the device's own requestDmAccess auto-admits over a real wire connection presenting only the delegated token -- the "trust this whole person, not just one device" flow agent-comms#187 describes.
…ust object literals
Mearman
force-pushed
the
feat/principal-keyed-gateway-trust
branch
from
September 18, 2026 08:26
5a26ada to
1d3b36a
Compare
Mearman
marked this pull request as ready for review
September 18, 2026 08:29
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. |
|
🎉 This PR is included in version 3.16.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #187
Extends
GatewayTrustandadmitAgentForDmto accept a user-principal device-id as the trusted/admitted party, not just a bare device-id, so a remote peer presenting a token whose delegation chain roots back to a trusted/admitted principal can pass, with the principal's own delegation depth allowed to sub-delegate to its own devices.Work in progress: GatewayTrust's own principal allowlist lands first; admitAgentForDm's delegation-depth extension and the principal-to-own-device sub-delegation primitive follow as separate commits on this branch.