Skip to content

feat(secureservice): audit admission decisions#686

Draft
ZanzyTHEbar wants to merge 7 commits into
anyproto:mainfrom
ZanzyTHEbar:federated-admission-audit
Draft

feat(secureservice): audit admission decisions#686
ZanzyTHEbar wants to merge 7 commits into
anyproto:mainfrom
ZanzyTHEbar:federated-admission-audit

Conversation

@ZanzyTHEbar

Copy link
Copy Markdown

Stack

Seventh PR in the federated admission stack, after:

This PR is draft until the lower stack lands. Please review as the delta after #685.

Summary

  • Adds structured admission decision logs for accepted, rejected, and missing-token handshakes.
  • Keeps remote handshake behavior unchanged: peers still receive existing invalid-credentials errors.
  • Avoids logging bearer tokens, verifier error strings, rejection reasons, or arbitrary claims.

Security

  • Logs only stable metadata: peer ID, network ID, client version, proto version, required/enforced state, token presence, allowed state, and whether the verifier errored.
  • Tests include privacy canaries for token, verifier reason, verifier error, and claims to guard against accidental leakage.

Validation

  • PASS: go test -buildvcs=false ./net/secureservice
  • PASS: go test -buildvcs=false ./net/secureservice ./net/secureservice/handshake ./net/peerservice
  • PASS: go test -buildvcs=false ./... -run '^$'
  • Known unrelated failure remains: go test -buildvcs=false ./... fails in net/rpc/limiter TestLimiter_Concurrent_Bursts (40 not <= 38).

Risks

  • Accepted admissions log at debug level; rejections log at info level.
  • No admission tokens, verifier-controlled strings, or claims are logged.

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.
Add structured admission decision logs for accepted, rejected, and missing-token handshakes without logging bearer tokens, verifier errors, rejection reasons, or claims. Cover log fields and privacy canaries in focused secureservice tests.
@ZanzyTHEbar

Copy link
Copy Markdown
Author

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

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