Repository navigation
fix(captures): never quote a bad store netloc; keep Azure reads inside the prefix - #76
Merged
Merged
Conversation
…e the prefix Port evalshift-sdk #20 and #21 to the CLI's copy of the store grammar and Azure reader. - parse_store_uri catches urlsplit's own ValueError (two of which quote the netloc) and raises "store URI names an invalid bucket or account; accepted forms: ..." outside the except, so nothing is chained. - has_unsafe_segment(): an az:// container or prefix with an empty, "." or ".." segment is rejected, and AzureBlobStore refuses such a container or prefix at construction and such a key on get. The Azure client resolves dot segments in the request URL, even across containers. Co-Authored-By: Claude Opus 5.5 <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.
Brings the CLI's own copy of the store code in line with two evalshift-sdk fixes, so both sides behave and word their errors the same way:
parse_store_urinever quotes a malformed netloc.or..segmentWhat changes
captures/store_uri.pyurlsplitrejects some netlocs on its own (a bracketed host that is not an IP address, a character that NFKC-normalises to/), and two of those errors quote the netloc, which can hold a pasted secret. The parser now catches that and raisesstore URI names an invalid bucket or account; accepted forms: .... It raises outside theexcept, so no exception is chained (__cause__and__context__are bothNone).has_unsafe_segment(path), copied from the SDK. Anaz://container or prefix with an empty,.or..segment is rejected with the SDK's message. S3 and GCS keep such prefixes literal and still accept them.captures/stores/azure.pyAzureBlobStoreraisesValueErrorfor such a container or prefix at construction, and for such a key inget(), before any client call. The Azure client resolves dot segments in the request URL, even across containers, soaz://acct/evals/../otherused to read from containerother.list()is not checked because its prefix is sent as a query parameter, not in the URL path. The keyscapture syncdownloads were already filtered to the SDK's layout, so thegetcheck is a second safeguard. The exposure that actually happened was through the configured prefix.evalshift.yamlloading picks this up through the existingcaptures.storevalidator: both new errors fail at load, and the config test now checks that neither leaks the secret.Tests (written first, watched fail)
test_captures_store_uri.py: the SDK's bad-netloc vectors (fixed message, netloc absent, nothing chained), the exact message, the SDK's Azure dot-segment vectors, a check that S3/GCS keep dots literal, andhas_unsafe_segmentvectors.test_captures_stores.py:AzureBlobStore.getrefuses unsafe keys with no client call, keeps ordinary dots, and refuses unsafe containers and prefixes. Prefix slashes are still stripped.test_config_captures.py: the loader error fors3://[SUPERSECRET]/keyandaz://acct/evals/../SUPERSECRETnever contains the secret.Docs
CHANGELOG
## [Unreleased]→### Fixed. DOCS.md (captures sync paragraph),llms-full.txt(captures:block) anddocs/configuration.md#capturesnow state the rules.Verification
make ci: ruff check, ruff format check and mypy --strict are clean. pytest: 3564 passed, 1 skipped, coverage 95.39%.pre-commit run --all-filespasses.Not merged, per the request.
🤖 Generated with Claude Code