Skip to content

fix(snapshot): stream a service's export only from its own address - #400

Merged
earakely-scale merged 1 commit into
mainfrom
edgararakelyan/export-uri-same-origin
Oct 30, 2026
Merged

earakely-scale merged 1 commit into
mainfrom
edgararakelyan/export-uri-same-origin

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

snapshot_env asks each env service for its data with data/get. When the answer is a FilePart with an http(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 on 127.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 a FilePart with neither bytes nor a uri already does.

Nothing that exists today is affected:

  • A relative uri (export-snapshot?stream=1 from the synthetic servers' BaseService) is still resolved against the service's address.
  • A non-http uri (an s3:// object the service uploaded itself, or an upload through the namespace grant) is still handed back without a download.
  • No in-tree env or synthetic server returns an absolute http(s) uri.
  • httpx 0.28 follows no redirects by default and raise_for_status raises on a 3xx, so a relative uri can't be redirected to another host either.

Testing

  • New test_export_service_to_file_refuses_an_absolute_uri_off_its_service_address covers 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.
  • The relative-uri streaming test now also runs with an absolute uri on the service's own address, which still streams.
  • tst/unit/task_step/ snapshot suites: 84 passed.
  • Full unit suite on macOS: 11,796 passed and 66 skipped. The one failure is test_hermes_bridge.py::test_the_event_pipe_is_not_left_open_in_the_server, which reads /proc/self/fd (Linux only).
  • ruff check is clean.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence 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.

  • Snapshot exports only fetch HTTP links from the service’s own address.

Reviews (1) · Last reviewed commit: "fix(snapshot): stream a service's export..." · Reviewed by Greptile

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>
@earakely-scale
earakely-scale requested a review from a team as a code owner October 29, 2026 23:30
@earakely-scale
earakely-scale merged commit a6d4185 into main Oct 30, 2026
25 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/export-uri-same-origin branch October 30, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant