Skip to content

Merge train: #569 #568 - #588

Merged
Antnation merged 17 commits into
mainfrom
train/round-4
Oct 20, 2026
Merged

Antnation merged 17 commits into
mainfrom
train/round-4

Conversation

@Antnation

Copy link
Copy Markdown
Contributor

Merge train for two PRs that were adversarially reviewed, fixed, and then confirmation-reviewed on their post-review deltas. Both are CI-green on their own heads. Plain --no-ff merges onto current main (which now includes #587), with no conflict resolutions. When this merges, GitHub marks each PR merged.

Work in progress, parked when the implementing session stopped. Not yet compiled by CI or reviewed. Part of #463.
Work in progress, parked when the implementing session stopped. Not yet compiled by CI or reviewed. Part of #422.
Main's #566 rewrote the caller-assertion refusal tests to serve the API
key and signing key from a counting provider, which proves the #556
refusal never consults a secret provider. That proof is kept. The
signing key it serves is now a generated PKCS#8 key, and the fixture
saves the Connection through the same deferred-binding pass the admin
API runs, so the key is really loaded. The tests assert that the save
read each secret exactly once, and that the refused call and the
composite leaf read nothing more.

Both schemas take main's opening for the caller_assertion block and
describe the keys this branch now resolves and publishes.
Standalone mode pinned nothing per request, so one tool invocation was
judged by separate live reads: admission, the rendered-HTTP rule and the
playground's recheck. A revision installed in between, including during
the queue wait, could pair one snapshot's admission with another's rules
and allow what neither snapshot allows (#422).

ToolRuntime now runs every invocation inside
RbacState::with_request_policy_snapshot, so admission, the queue wait,
the playground precondition, the rendered-HTTP rule and composite leaf
enablement answer from one snapshot: the admitted bundle in cluster
mode, the live lane read once at the start in standalone mode. The
playground's last rendered-HTTP check deliberately reads the live lane
through RbacState::with_live_policy, as its management-lane permission
check already does. Both follow a pinned decision that allowed the
call, so they can only refuse, and a deny published while the
precondition ran still stops the call.

The enum-source precheck now judges its enable bit and deny rules
through authorize_source_request, which takes the one snapshot its
caller read.

The adapter also stops trusting effects it does not expect. An Allowed
invocation and a no-rule rendered answer are admitted only on the
evaluator's own Allow effect, so a kernel change fails closed. The
three refusal reasons are observed as 403 policy blocks rather than as
a 503 runtime rejection.

New tests install a revision between admission and rendering, and
during the queue wait. They pin the precondition's permission and
eligibility to the request snapshot while the management lane reads
live, and hold a ToolEligibilitySnapshot to the policy it was taken
from. The enum precheck is held to one snapshot, and the playground's
served path is driven through the runtime.

Comments that claimed every registry source bounds tool names at 128
characters now name the TOOLS_FILE exception.
#422 asks each slice to record its migrated lanes and parity fixtures.
The parity matrix still said tool admission had not been migrated. It
listed the open 4 KiB tool-name gap and described tests against
"unchanged live consumers".

The matrix now names the kernel adapters for the five tool rows, plus
the two paths still matched with RuleMatcher: the enum-source precheck
and the non-RBAC fallback. It records:
- the frozen 05c295a oracle and the differential fixtures (proptest
  seed 422_002, 128 cases, and the named matrix);
- the refusal mapping and the new bounds;
- which snapshot judges each tool decision in each mode, including what
  stays unpinned.

The published policy schema bounds rules[].tool_name and tools keys,
so it no longer accepts policies the gateway refuses. JSON Schema
counts characters, so its bound is the looser one, never the stricter.
A test pins both sides at the same byte for ASCII names.

docs/configuration.md documents the rendering refusals (empty or dot
segments, malformed escapes). It also covers the per-invocation
snapshot, the playground's refuse-only live rechecks, and the
4096-byte name bound as a rolling-upgrade note.
The egress-only gate failed on six scopes this branch changed. The
adversarial review of #569 examined each one and found that none adds
network or transport capability:

- RbacPolicyState#1: the legacy rule_matcher field is now cfg(test).
- tokio::task_local#1: PINNED_POLICY is now unconditional, so the
  standalone tool runtime can pin an in-process policy snapshot. No
  I/O.
- ToolEvaluation::canonical_trace_bytes#1 and reusable_for#1: narrow
  expect(dead_code) attributes, needed once the tools module-wide
  allowance was removed.
- policy_eval::tools::attributes#1 and PrincipalFact#1: their
  attributes are gone, so the records are removed.

Only these records change. Their hashes come from the guard's syntax
tool, built standalone with the syn, quote, proc-macro2 and sha2
versions in Cargo.lock. That build reproduced every committed hash on
an untouched main tree, and on this branch it reports no other
difference.
Releases since #556 stored an enabled Connection's caller_assertion
without reading its signing key, so a stored document can name an alias
that is unconfigured, a placeholder, or not a PKCS#8 key. Checking those
keys at load made ConnectionControlPlane::from_config refuse to start and
made a cluster reconcile fail for the whole snapshot, which takes every
other Connection down with one document.

Keys are now checked apart from credentials when a stored document is
loaded. Startup and reconcile still refuse a credential this replica
cannot resolve, as before, but a caller-assertion key that cannot be used
leaves only that Connection's keys out of the JWKS. It is logged with the
Connection, field and code, and reported as
configuration.caller_assertion.key_problem on the admin detail. The #556
refusal is unchanged, so the Connection stays refused on every lane. A
save is still held to the write-time rule and refused with the existing
safe codes until the key is usable; disabling needs no key.

The JWKS build follows the same rule: a Connection publishes all of its
keys or none. One whose key cannot be read or loaded, or that publishes a
kid another Connection publishes for a different key, is left out, and
the rest of the set is still published rather than the whole set going
503. A set that left a Connection out is rebuilt after 30 seconds instead
of 300.

The build no longer holds the cache lock across secret resolution. The
cache sits behind a short std lock, a separate async lock serializes
builds, and a fetch that arrives during a rebuild for the same keys is
answered from the previous set instead of queueing on the provider. A
fetch with nothing it may serve waits at most 10 seconds and then gets
503 no-store. The snapshot is read again once the build lock is held, so
a waiter can no longer rebuild from an older snapshot and republish a
withdrawn key. Each alias is resolved once per build. After a failed
refresh the gateway does not keep serving the last good keys: what an
unpinned alias holds may have changed, and the gateway does not use such
an alias's material as a stale fallback.

The PEM check now counts every BEGIN marker in the material, because the
parser skips blocks whose label it does not know. The kid-uniqueness
comment now says the write check is per replica and the JWKS is the
backstop.

The admin-router caller-assertion tests from #566 now bind a real key
and create with secrets-write, since a caller assertion is credential
authority. They assert that a routine rename by an editor still passes
and that removing the block without secrets-write is refused.
The safe read now carries a caller assertion's published_keys and, when
the gateway leaves the Connection's keys out of its JWKS, a key_problem
naming the field and a fixed code. The admin UI dropped both: its
projection kept only the fields it knew, so the editor contract test
that compares the fixture with the published schema would fail, and an
operator had no sign why a Connection's keys were missing.

The projection now validates and keeps both fields in the gateway's
serialization order. The read-only summary lists each published key and
shows an alert explaining the problem and how to clear it. It also says
that removing the block through the admin API needs secrets-write.
Issue #463 asks for the JWKS endpoint and its rotation procedure to be
documented. The operator guide said only that the block is stored, and
nothing about what this branch adds.

The Signed caller assertions section now covers the PKCS#8 and algorithm
requirements, where a key may live (never the encrypted local store),
the save-time error codes, and the secrets-write requirement. It
describes the public JWKS: authentication and RBAC exempt, never proxied,
public members only, one set for the whole gateway so verifiers must pin
iss and aud, caching and refresh, and the choice not to serve old keys
after a failed refresh. It explains the per-Connection degradation for
stored documents with its log line and key_problem, and gives a
step-by-step rotation procedure. An upgrade note says what changes for a
Connection stored by an earlier release. configuration.md records that
the JWKS path is exempt from authentication and RBAC independently of
AUTH_EXEMPT_PATHS and RBAC_EXEMPT_PATHS.
Renaming _connections to connections changes the syntax hash of the
reviewed AppState scope, so egress-only asked for a new review. The
review found no new transport authority. The struct only gains a name
and a doc comment, and its network reason comes from members this record
already covers. The rename exposes the existing control plane to the
public JWKS handler, so an unauthenticated GET can trigger existing
secret-provider reads. Those reads go only to operator-configured
destinations under the unchanged egress policy and the providers' own
deadlines, and the JWKS cache, one read per alias per build and the IP
rate-limit lane bound them.

Only this record changes: its hash comes from the guard's inventory of
this head, and its purpose now states that review.
The tool-name schema test was inserted between the auth-methods test's doc
comment and its function, so the new test carried both comments and the
old one carried none.
…n-kernel

Route tool admission through the shared policy evaluator
…s-jwks

Resolve caller-assertion signing keys and publish them as JWKS
Copilot AI balanced review requested due to automatic review settings October 20, 2026 16:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T16:26:57.376380Z 3f7723c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f7723c9fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1907 to +1910
let material = self
.secret_resolver
.resolve(alias, SecretPurpose::AssertionSigningKey)
.await

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound the initial JWKS build across all key reads

When the cache is empty or invalidated, the request that becomes the builder awaits every distinct external-secret alias sequentially, and each provider applies only its own per-read deadline. With up to 256 Connections and five keys per Connection, several slow or unavailable aliases can therefore hold this unauthenticated request—and keep concurrent JWKS fetches returning 503 after their 10-second wait—for the sum of hundreds of provider deadlines. Apply an overall build deadline or resolve aliases with bounded concurrency so one slow key does not make the entire published set unavailable for an unbounded aggregate duration.

Useful? React with 👍 / 👎.

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.

2 participants