fix(gateway): bind HTTP auth to routed profiles - #72285
Conversation
|
looks mergeable The change closes the cross-profile HTTP authentication gap on both affected shared-listener surfaces. API-server authentication now derives the expected bearer key from the URL-selected profile's installed secret scope and fails closed for a named profile with a missing, weak, or unresolvable key. Webhook routes now bind their existing HMAC secret to one explicit profile, with omitted bindings remaining default-only and malformed bindings rejected. A focused local probe reproduced current main accepting the default API key for a named profile and accepting one signed webhook route on two profile prefixes; the same probe at the reviewed head rejected both cross-profile cases while accepting the intended profile credentials. Review of middleware ordering, route registration, dynamic/static route handling, profile validation, and all authentication call sites found no residual path that bypasses these checks. Security evidence:
Uncertainty: The full repository pytest environment was unavailable because the available Python environment lacks pytest, aiohttp, and httpx, so the added pytest suite could not be executed directly. The merged current-main-plus-PR result was checked textually rather than executed; the three-way merge contained no conflict markers. Signed: GPT-5.6-sol-xhigh in Codex |
The multiplexed listener now rejects the default API_SERVER_KEY on /p/<profile>/ prefixes (fail-closed per-profile keys). Add the multi-profile routing section with an explicit breaking-change callout for the next release notes.
The multiplexed listener now rejects the default API_SERVER_KEY on /p/<profile>/ prefixes (fail-closed per-profile keys). Add the multi-profile routing section with an explicit breaking-change callout for the next release notes.
…72285 The multiplexed listener now rejects the default API_SERVER_KEY on /p/<profile>/ prefixes (fail-closed per-profile keys). Add the multi-profile routing section with an explicit breaking-change callout for the next release notes.
…72285 The multiplexed listener now rejects the default API_SERVER_KEY on /p/<profile>/ prefixes (fail-closed per-profile keys). Add the multi-profile routing section with an explicit breaking-change callout for the next release notes.
…72285 The multiplexed listener now rejects the default API_SERVER_KEY on /p/<profile>/ prefixes (fail-closed per-profile keys). Add the multi-profile routing section with an explicit breaking-change callout for the next release notes.
…72285 The multiplexed listener now rejects the default API_SERVER_KEY on /p/<profile>/ prefixes (fail-closed per-profile keys). Add the multi-profile routing section with an explicit breaking-change callout for the next release notes.
Summary
Fixes #72041.
/p/<profile>/...API_SERVER_KEYinstead of inheriting the default listener key/p/default/...compatible with the default profileRoot cause
The shared HTTP listeners used the URL prefix to select the runtime profile, but authorization was not bound to that selection. A valid default API key or webhook route secret could therefore be presented on another profile path while the request executed under the URL-selected profile.
Validation
13 passed— API profile scope and multiplex routing tests97 passed, 1 deselected— webhook adapter testsruff checkpassed for all modified Python filesgit diff --checkpassedThe deselected webhook test is a pre-existing Windows dual-stack bind failure. The same isolated test was reproduced on a clean
origin/mainworktree, confirming it is unrelated to this change.