Expand description
Dispatch-time credential interception (AUTHZ-CRED-CORE-2).
This module contains the plexus-core half of the dispatch-time
credential interception described in AUTHZ-CRED-CORE-2. The other half
lives in plexus-auth-core:
Credential<T>::Serializeemits the sentinel{"$credential": "<id>"}inline AND captures the inner value into a thread-local sidecar when aDispatchCaptureGuardis active on the current thread.DispatchCaptureGuard::installis the (currentlypub(crate)) setter for that thread-local.
plexus-core’s responsibility is, at every dispatch-time serialization point that produces a wire stream item:
- Install a fresh dispatch sidecar before serializing.
- Serialize the body — credentials within emit sentinels inline and register their values in the sidecar.
- Drain the sidecar and attach the captured entries to the wire
envelope as a
_credentialsfield. - Apply cookie projection: for entries whose
AttachmentSite::Cookie { name }matches the active transport’s cookie-capable surface, drop thevaluefield from the sidecar entry and record aSet-Cookieprojection hint that the transport layer reads.
See plans/AUTHZ/AUTHZ-CRED-CORE-2.md for the full required-behavior
table and plans/AUTHZ/AUTHZ-CRED-CORE-2-RUN-NOTES.md for the
capture-side blocker.
Structs§
- Cookie
Projection Hint - Out-of-band projection hint emitted alongside a stream item whose
payload contained a cookie-shaped credential. The transport layer
reads these hints and turns each one into a
Set-Cookie: <name>=<value>; HttpOnly; Secure; SameSite=None; Path=/; Max-Age=<seconds>header on the response.
Enums§
- Cookie
Projector - Per-transport policy for which
AttachmentSite::Cookiecredentials should be projected intoSet-Cookieheaders and removed from the JSON sidecar’svaluefield.
Functions§
- check_
returns_ schema_ for_ credentials_ collision - Inspect a serialized JSON value’s top-level keys and emit a
schema-build warning if any of them are
_credentials. Used by the schema constructors (PluginSchema::leaf,::hub) to surface AUTHZ-CRED-CORE-2 acceptance criterion #8 at build time. - format_
set_ cookie_ header - Compute the
Set-Cookieheader string for a single projection hint. - warn_
on_ credentials_ field_ collision - Schema-build warning emitted when a method’s return-type schema
declares a top-level field named
_credentials. The framework reserves that name for the credential sidecar (AUTHZ-CRED-CORE-2 §“Wire envelope shape”). When a backend has such a field, the framework’s projection shadows it.