Skip to content

feat(auth): add versioned authorization context contract - #3564

Draft
cea-block wants to merge 8 commits into
fsola/corporate-identityfrom
cea/shared-auth-context
Draft

feat(auth): add versioned authorization context contract#3564
cea-block wants to merge 8 commits into
fsola/corporate-identityfrom
cea/shared-auth-context

Conversation

@cea-block

@cea-block cea-block commented Jul 29, 2026

Copy link
Copy Markdown

Summary

Adds a provider-neutral authorization-context contract stacked on PR #1476.

  • Introduces an immutable, versioned authorization context finalized from server-verified evidence.
  • Keeps the authenticated Nostr actor distinct from an optional issuer-qualified federated principal.
  • Represents active bindings with stable identifiers, positive versions, explicit provenance, and an authoritative lifecycle result.
  • Keeps direct authorization separate from delegated owner authorization and current owner admission.
  • Enforces authorization-domain, transport, principal, key, delegation, key-attestation, and server-time bounds.
  • Provides stable, provider-neutral decision codes while redacting identity and security posture from debug output.
  • Renames the existing relay type to ConnectionAuthContext so it remains distinct from the new contract.

Stack position

This draft is the contract-only layer of a stacked implementation. It does not change runtime authorization behavior, database schema, persistence, configuration, or route policy. Production code cannot construct the new trusted evidence or authorization context in this phase.

The stack can proceed in reviewable layers:

  1. PR #1476 provides the identity-binding foundation.
  2. This draft defines the portable authorization context and its invariants.
  3. The next stacked draft will add a provider-neutral authorization-provider interface and synthetic conformance tests.
  4. Later work will add persistence adapters, runtime transport adoption, live-session revocation, audit coverage, and operator recovery.

Standards compatibility remains a later, non-blocking follow-up after the Buzz Core team selects a normative target.

Security properties

  • Raw assertions, headers, tokens, and caller-selected identities cannot construct trusted evidence.
  • A transport caller cannot label a newly enrolled binding as pre-existing. The binding evidence privately carries its authoritative lifecycle result.
  • Existing active bindings remain independent of the current enrollment mode. New enrollment remains constrained by policy, provenance, and matching key-attestation evidence.
  • Blossom proof authorizes media upload only. Authenticated media download requires NIP-98.
  • Narrow delegation cannot be promoted into transport-wide authority by this contract.
  • Trusted evidence has private fields and no default or deserialization path. Production construction remains intentionally unavailable.

Testing

  • cargo fmt --all -- --check
  • cargo test -p buzz-auth --lib — 94 passed
  • cargo clippy -p buzz-auth -p buzz-relay --all-targets -- -D warnings
  • git diff --check
  • One full just ci ready gate covered workspace checks, Rust tests, desktop tests and builds, web checks and build, and mobile analysis. Its only non-green result was the Flutter test ChannelDetailPage keeps follow mode off while a tall newest message stays visible; the exact test reproduces identically on this branch and the unchanged parent.
  • Exact-head adversarial review at 8194b888cf512090637619f0e10054d2492ac424: Claude 9/10, GPT 9/10, and Gemini 10/10. All approved with no critical or high findings.
  • Complete stacked-diff data-hygiene review.

Generated with Codex

@cea-block
cea-block force-pushed the cea/shared-auth-context branch 2 times, most recently from a0f9706 to 8194b88 Compare July 29, 2026 21:48
@cea-block
cea-block force-pushed the fsola/corporate-identity branch from 0390d06 to a28957d Compare August 3, 2026 13:36
@cea-block
cea-block force-pushed the cea/shared-auth-context branch from 8194b88 to 49af926 Compare August 3, 2026 15:34
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
(cherry picked from commit 49af926)
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
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