Repository navigation
fix(coordinator): fail closed on capabilities and internal auth, check host ownership - #1850
Merged
Merged
Conversation
The simulator sends SIM_HTTP_TOKEN on every internal HTTP request, but the replica used CoordinatorConfig::default(), which has no tokens. With the internal routes now fail closed, every harness-event and admin call got 401, and the simulation and dst tests failed. Configure the replica with the token so the bearer middleware runs and accepts it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… refresh A host that does not run the session now gets 403 before any 409, so it cannot learn whether another host's session is terminal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RFC 9110 section 11.1 makes the auth scheme case-insensitive, and RFC 6750 section 2.1 allows one or more spaces before the token. The shared parser now accepts "bearer" and "BEARER" and extra spaces. The token itself stays exact: no whitespace in it, compared byte for byte. The constant-time compare now passes the accumulator through std::hint::black_box, so the optimizer cannot turn the loop into an early exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With no ENGRAM_AUTH_TOKENS, the router logs an error (every internal request is refused) or, with ENGRAM_ALLOW_INSECURE_INTERNAL_AUTH=1, a warning (internal routes are open). An operator whose hosts get 401 after the upgrade sees the cause in the coordinator log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omment The comment pointed at token-list filtering in main.rs that this branch moved into the auth constructors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an upgrade note to the changelog and state the empty-value behavior in the deploy guide and the configuration reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nikhilunni
force-pushed
the
audit/p0-coordinator-security
branch
from
December 2, 2026 21:57
c50f3d9 to
9895169
Compare
nikhilunni
marked this pull request as ready for review
December 3, 2026 17:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens
engram-coordinatorauthentication, credential minting, host-session ownership, and eviction error propagation:get_session_capabilitiesinapi/forge.rsandsession_boot.rsinstead of falling back to unscoped provider defaults.host_http::refresh_inject: Verifies the session exists and is bound to the requestinghost_id(403), then that it is non-terminal (409), before minting credentials. The ownership check comes first, so a host cannot learn the state of a session it does not run.AuthState::new, fails closed whenENGRAM_AUTH_TOKENSis empty unlessENGRAM_ALLOW_INSECURE_INTERNAL_AUTH=1(local dev; the Tiltfile sets it), and consolidates constant-time comparison andBearerextraction intocrates/engram-coordinator/src/auth.rs. The parser follows RFC 6750 section 2.1 and RFC 9110 section 11.1: the scheme is case-insensitive, one or more spaces are allowed, and the token is exact with no whitespace. The router logs an error at startup when no token is set (or a warning when the insecure bypass is on).op_cancel_queuedinapi/snapshot.rsinstead of swallowing them with.unwrap_or(false). All callers map the error to an opRetry.engram-dstconfigures its coordinator replica withSIM_HTTP_TOKEN, so the bearer middleware runs and accepts the simulator's requests.Upgrade note
A deployment that runs the coordinator with no
ENGRAM_AUTH_TOKENS(Helmauth.existingSecret: "") now refuses every host request. The changelog carries the upgrade note. The shipped Terraform quickstarts and the e2e stack (Tilt) already set the token or the dev bypass.Merge order
#1857 also changes
api/mod.rs(theAuthState::newline and its comment) and adds agrpc_apptest that calls the internal HTTP router without a bearer. Whichever PR lands second must resolve theapi/mod.rsconflict and give that test a token (orallow_insecure_internal_auth: true).Validation
cargo fmt --checkcargo clippy -p engram-coordinator -p engram-dst --all-targets -- -D warningscargo nextest run -p engram-coordinator(non-live-PG): 545 passedcargo nextest run -p engram-dst: 58 passedsite: leak lint🤖 Generated with Claude Code