Skip to content

feat(federation): authorizeInbound ingress authorizer (PR-D1) - #73

Merged
alexfrmn merged 1 commit into
mainfrom
jarvis/auth-authorize-inbound
Jun 22, 2026
Merged

feat(federation): authorizeInbound ingress authorizer (PR-D1)#73
alexfrmn merged 1 commit into
mainfrom
jarvis/auth-authorize-inbound

Conversation

@alexfrmn

Copy link
Copy Markdown
Owner

What (PR-D1 of auth/authz #47)

The pure ingress authorizer. Decodes an envelope's bearer authToken and verifies it against the roster, binding the token subject (actor) to the envelope senderAgentId. (PR-D2 wires it into broker-nats behind MURMUR_ENFORCE_AUTH.)

authorizeInbound(envelope, rosters, { localOrg, audience, requiredScopes, enforce, now })
  -> { accepted, reason? }

Guardrails (all from your design-review)

  • Actor binding: senderAgentId is bare on the wire; parsed into an AgentAddress via localOrg before comparing to token.subject (raw compare would always mismatch — your note).
  • Gate: enforce=false → no token passes through; enforce=true → missing token = auth-missing.
  • No token logging — pure, returns a reason; callers audit msgId/sender/audience/reason only.
  • Delegates to verifyAuthToken (audience + requiredScopes + requiredSubject).

Tests (federation 30/30, +5)

enforce-off pass-through · enforce-on missing→auth-missing · valid bound token accepted · different sender→subject-mismatch · scope-missing · audience-mismatch · garbage→malformed.

Verification

build PASS; full npm test 0 fail; git diff --check clean. Pure helper — no transport touched.

Review by diff + CI. @codex PR-D1; PR-D2 (broker-nats enforce behind MURMUR_ENFORCE_AUTH, NACK auth-rejected:) is the final piece.

PR-D1 of auth/authz #47 (pure helper; broker wiring is PR-D2). Decodes an envelope's
bearer authToken and verifies it against the roster, binding the token subject (actor)
to the envelope sender:

- authorizeInbound(envelope, rosters, { localOrg, audience, requiredScopes, enforce, now })
  -> { accepted, reason? }.
- enforce=false: no authToken -> accepted (MURMUR_ENFORCE_AUTH gate off). enforce=true:
  missing token -> auth-missing.
- senderAgentId is BARE on the wire; parsed into an AgentAddress via localOrg before
  comparing to token.subject (raw-string compare would always mismatch — Codex note).
- delegates to verifyAuthToken with audience + requiredScopes + requiredSubject.
- AuthorizeInboundReason = AuthTokenRejectReason | auth-missing. Pure: no transport, no
  logging (callers audit msgId/sender/audience/reason, never the token body).

Tests (federation 30/30, +5): enforce-off pass-through; enforce-on missing -> auth-missing;
valid bound token accepted; different sender -> subject-mismatch (actor binding);
scope-missing; audience-mismatch; garbage token -> malformed.

Verified: build PASS; full npm test 0 fail; diff --check clean.
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@alexfrmn
alexfrmn merged commit 0e2f2dd into main Jun 22, 2026
1 check passed
@alexfrmn
alexfrmn deleted the jarvis/auth-authorize-inbound branch June 22, 2026 17:35
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.

1 participant