Skip to content

feat(secureservice): wire JWT admission config#684

Draft
ZanzyTHEbar wants to merge 5 commits into
anyproto:mainfrom
ZanzyTHEbar:federated-admission-jwks
Draft

feat(secureservice): wire JWT admission config#684
ZanzyTHEbar wants to merge 5 commits into
anyproto:mainfrom
ZanzyTHEbar:federated-admission-jwks

Conversation

@ZanzyTHEbar
Copy link
Copy Markdown

Stack

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

It is draft until the lower stack lands.

Summary

  • Build a JWT admission verifier from AdmissionConfig when admission is enabled and no verifier was injected.
  • Fetch JWKS at startup with a bounded read and sanitized request errors.
  • Preserve disabled-by-default behavior and explicit verifier injection.

Security

  • Does not enable admission unless admission.enabled or admission.required is set.
  • Does not log or return configured JWKS URLs from request failures.
  • Limits JWKS response bodies to 1 MiB.
  • Keeps JWKS static after init; key rotation requires restart in this slice.

Validation

  • PASS: go test -buildvcs=false ./net/secureservice
  • PASS: go test -buildvcs=false ./net/secureservice/handshake
  • PASS: go test -buildvcs=false ./... -run '^$'
  • PASS: go test -buildvcs=false ./net/transport/quic ./net/transport/webtransport ./net/transport/yamux
  • 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.
@ZanzyTHEbar
Copy link
Copy Markdown
Author

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

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