Skip to content

feat(peerservice): add admission token provider#685

Draft
ZanzyTHEbar wants to merge 6 commits into
anyproto:mainfrom
ZanzyTHEbar:federated-admission-token-provider
Draft

feat(peerservice): add admission token provider#685
ZanzyTHEbar wants to merge 6 commits into
anyproto:mainfrom
ZanzyTHEbar:federated-admission-token-provider

Conversation

@ZanzyTHEbar
Copy link
Copy Markdown

Stack

This is the sixth PR in the federated admission stack and is intended to be reviewed after:

It is draft until the lower stack lands.

Summary

  • Add provider-neutral AdmissionTokenProvider for outbound handshake tokens.
  • Let peerservice discover an optional provider component and inject its token before transport dialing.
  • Preserve caller-supplied CtxWithOutboundAdmissionToken values and fail closed on provider errors.

Scope

  • No OIDC, token refresh, browser flow, or token storage implementation.
  • No handshake or verifier behavior changes.
  • Provider returns an empty token to preserve existing no-token dialing behavior.

Validation

  • PASS: go test -buildvcs=false ./net/secureservice ./net/secureservice/handshake ./net/peerservice
  • PASS: go test -buildvcs=false ./net/pool ./net/transport/quic ./net/transport/webtransport ./net/transport/yamux
  • PASS: go test -buildvcs=false ./... -run '^$'
  • KNOWN FAIL: go test -buildvcs=false ./... fails only in pre-existing unrelated net/rpc/limiter TestLimiter_Concurrent_Bursts (40 not <= 38).

Introduce provider-neutral admission config and verifier types for future federated network admission support. The new config is disabled by default and does not change handshake behavior.
Add a static JWKS-backed AdmissionVerifier implementation for provider-neutral federated admission. The verifier validates token signature, issuer, audience, expiry, network id, Anytype identity binding, subject, and required claims without wiring it into the handshake yet.
Add an additive handshake credentials field for provider-neutral admission tokens and propagate it through secureservice contexts. This only carries tokens for future admission enforcement; it does not validate tokens or change existing handshake behavior.
Add provider-neutral inbound admission enforcement by composing AdmissionVerifier with credential checking. Admission remains disabled by default, config-only enablement fails fast until verifier construction is wired, and callers can inject a verifier through NewWithAdmissionVerifier.
Build the JWT admission verifier from secure-service admission config when admission is enabled and no verifier was injected. JWKS retrieval is bounded, sanitized, and skipped for disabled admission or explicit verifier injection.
Allow an optional provider component to supply outbound admission tokens before dialing peers. Caller-provided tokens take precedence, provider errors fail closed, and no OIDC or token storage implementation is introduced.
@ZanzyTHEbar
Copy link
Copy Markdown
Author

/oc please review this draft stacked PR, focusing on the delta after #684

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