Repository navigation
fix(snapshot): stream a service's export only from its own address - #400
Merged
Merged
Conversation
snapshot_env streams an absolute http(s) FilePart uri from this process, so a service could name any host this process can reach (loopback services, cloud metadata, internal hosts) and read the body back when its snapshot loads. An absolute uri must now share the service's scheme, host and port; anything else fails that service's export with no request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
snapshot_envasks each env service for its data withdata/get. When the answer is aFilePartwith anhttp(s)uri, this process streams it and stores the body as the snapshot's artifact. An absolute uri could name any host, so a service could point this process at something only it can reach and get the body back when its snapshot is loaded. Examples: the explorer on127.0.0.1:8234, the local registry, cloud metadata, or an internal host.An absolute uri must now have the service's own scheme, host and port. Anything else fails that one service's export with a
ValueError, before any request, the same way aFilePartwith neither bytes nor a uri already does.Nothing that exists today is affected:
export-snapshot?stream=1from the synthetic servers' BaseService) is still resolved against the service's address.s3://object the service uploaded itself, or an upload through the namespace grant) is still handed back without a download.raise_for_statusraises on a 3xx, so a relative uri can't be redirected to another host either.Testing
test_export_service_to_file_refuses_an_absolute_uri_off_its_service_addresscovers loopback, a metadata IP, another host, a userinfo trick (https://gw@internal.example/...), another port and another scheme. Every case raises with no request made and nothing written. All 6 fail on main.tst/unit/task_step/snapshot suites: 84 passed.test_hermes_bridge.py::test_the_event_pipe_is_not_left_open_in_the_server, which reads/proc/self/fd(Linux only).ruff checkis clean.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge.Summary
The PR blocks absolute HTTP export URLs whose scheme or address differs from the service’s base URL.
Reviews (1) · Last reviewed commit: "fix(snapshot): stream a service's export..." · Reviewed by Greptile