Repository navigation
AuthDeclaredButUnwired guard (follow-up on resolve_auth #5661): fail-closed pre-send typed error when an auth is declared but unwired, before the request leaves dispatch_rest -- never a remote 401 - #5683
Merged
Conversation
…ting witness
Split resolve_auth return from (String, Option<String>) into pub AuthResolution
{ NoAuthDeclared | Resolved{header,token} | DeclaredButUnwired{reason} } so
dispatch_rest cannot reach the send path with auth declared but no token —
the DeclaredButUnwired arm raises InterpError::AuthDeclaredButUnwired pre-send
before ureq constructs a request (§5 construction-first, never post-hoc check).
Adds 5-test discriminating witness: declared+withheld → typed error pre-send,
declared+empty auth_input → typed error, no auth declared → guard must NOT fire.
AuthResolution and resolve_auth are pub for snappy-otter-298's perturbation witness.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove early DeclaredButUnwired return inside the auth_input block so that when api_key is unbound/empty the function falls through to the auth_source env-var attempt. The guard fires only when BOTH paths are empty, preserving the precedence-with-fallback the real anthropic_rest.dag service relies on. Add 2 dual-declare witnesses: - dual_declare_env_var_fallback_resolves_when_input_empty: env var set → Resolved via fallback (regression guard — must NOT raise AuthDeclaredButUnwired) - dual_declare_both_empty_fails_closed: both paths empty → AuthDeclaredButUnwired All 7 tests green by execution; fmt + clippy -D warnings clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Clarifies that the wet-dispatch tests carry the execution discrimination; this test is an accessibility check only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merged
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.
Auto-opened by session-dashboard for session
fierce-crane-594.Pushing to
session/fierce-crane-594advances this PR.Worker attestation
Before flipping this PR to ready for review, confirm each item:
npm test,cargo test) and the result.Closes #Ndirective.Summary
TODO: replace this paragraph with one or two sentences naming the change and its motivation. Reviewers read this first.
Test plan