Repository navigation
fix(sandbox): the metrics scrape and the whitelist NetworkPolicy resolve each host one time, through the egress check - #2521
Merged
Conversation
…st builders The change folder 2431-sandbox-vet-addresses plans part 4 of #1381.
…onnect The scrape lost its pre-flight validate_url_egress check, which resolved the host a second time before the factory client resolved it at the connect. The client checks the address at the loopback level. The scrape still refuses a scheme that is not http or https, and a URL with no host.
…, with vet_addresses The public and local whitelist builders resolved a name with socket.getaddrinfo and classified the answers themselves, and the public whitelist validator resolved each name again. Now the validator makes no lookup, and each builder resolves a name one time with vet_addresses at the port of its entry: the public level, or the private level and then the private-or-loopback rule of the local whitelist. A builder refuses a cloud metadata name before the lookup, and a scoped IPv6 answer. A refusal is a SandboxValidationError that names the host, with the refusal of vet_addresses as its cause.
…d factory clients
…trics module to 1 The scrape catches only the ValueError of its URL check now, so the module has one swallowed failure. The ratchet refuses a count below its ceiling.
…nd the exit code The command test names the refused answer, which only the lookup of the policy builder gives. Thus the test fails when a whitelist validator makes the lookup again. The test of a failed lookup checks the exit code, as docs/TESTING.md tells an error-path test to do.
…es, and name the refused answer The purpose and the requirement of the one whitelist lookup had more than 25 words. The scenarios use the active voice. A refusal of an answer names that answer.
… refusal names the refused answer
…d the sandbox-egress spec
Owner
Author
|
Test evidence for the branch at 46db21f, rebased on Targeted tests
Fail-to-pass
The other failures come from the builder signature, which takes a port on the branch. The failed lines of the replay: |
dan-petty
marked this pull request as ready for review
October 28, 2026 19:51
dan-petty
pushed a commit
that referenced
this pull request
Oct 28, 2026
🤖 I have created a release *beep* *boop* --- ## [0.11.0](v0.10.1...v0.11.0) (2026-10-28) ### Features * **monitoring:** the roadmap Service's identity refusals, failing and stalled jobs, restarts, and GitHub and model request volume raise alerts ([#2496](#2496)) ([0137f23](0137f23)), closes [#2472](#2472) * **service:** roadmap-service runs at one replica, and each model call in the cluster is sent at most two times ([#2500](#2500)) ([2d32dae](2d32dae)), closes [#2494](#2494) ### Bug Fixes * **cli:** every command reports a DevOpsCLIError through one exit seam ([#2502](#2502)) ([eadd55f](eadd55f)), closes [#2487](#2487) * **github:** pr monitor waits until the checks settle and names every blocker, and pr ready reads the merge-readiness verdict ([#2498](#2498)) ([43326ea](43326ea)) * **k8s:** a pod that does not call the Kubernetes API mounts no service account token ([#2522](#2522)) ([305d3ba](305d3ba)) * **k8s:** the cloudflared tunnel replicas prefer different nodes and keep one up through a drain ([#2499](#2499)) ([d4edaf6](d4edaf6)), closes [#1023](#1023) * **k8s:** the grafana, prometheus, argo cd and loki clients dial through the egress-checked factory, and their pre-flight address checks go ([#2497](#2497)) ([e7ca1d5](e7ca1d5)) * **monitoring:** the roadmap Service alerts count a series that starts in the hour, and a lane of a new pod can stall ([#2514](#2514)) ([c7692b2](c7692b2)), closes [#2505](#2505) * **review:** a review's scanners leave out the rules that never gave a valid finding here ([#2508](#2508)) ([fe953ac](fe953ac)) * **roadmap:** a refine round leaves an outside account issue to a person, and refine neutralizes comment openers, www links and cross-repository references ([#2507](#2507)) ([e6230dc](e6230dc)), closes [#2478](#2478) * **sandbox:** the metrics scrape and the whitelist NetworkPolicy resolve each host one time, through the egress check ([#2521](#2521)) ([7c01426](7c01426)) * **security:** the subprocess environment guard refuses the zsh and interpreter keys that make a child run code ([#2510](#2510)) ([459621a](459621a)) * **service:** a restart keeps the halt, the budget window and the failure ledger, and a rate limit or a suspended installation stops every worker ([#2515](#2515)) ([3630de1](3630de1)), closes [#2474](#2474) ### Code Refactoring * **config:** settings resolve in one declared order through pydantic-settings sources ([#2518](#2518)) ([6a5447a](6a5447a)), closes [#2445](#2445) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.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.
The Prometheus scrape of the workload sandbox and the builders of the whitelist NetworkPolicy resolve each host name one time, through the resolve-and-check function of the egress policy (
vet_addressesindevops_cli.http.egress). Before, the scrape checked its URL with a pre-flightvalidate_url_egresscall, which resolved the name. Then the factory client resolved the name again at the connect. A rebinding DNS server could give a different address at each lookup. The public whitelist validator also resolved each name, and then the policy builder resolved the name again with a directsocket.getaddrinfocall and classified the answers itself. This change is part 4 of the split of #1381.The callers and their levels:
scrape_prometheus_metrics): loopback level. The pre-flight address check and its loopback shortcut go._validate_scrape_urlkeeps only the checks that read the URL: the scheme is http or https, and the URL names a host. An address refusal comes from the connect, and the scrape reports it as a failed scrape request. The error of the scrape does not start with "SSRF validation blocked scrape URL" any more._resolve_public_dns): public level._resolve_local_dns): private level. Then each address must be private or loopback, and not link-local, as before. Thus the local whitelist continues to refuse a link-local answer such as 169.254.1.2, which the private level admits._validate_public_whitelist_item): no lookup (is_loopback_or_private_host(host, resolve_dns=False)). The policy builder makes the one lookup, and refuses a name that answers an address that is not public.ai.allow_private_networkchanges none of these levels.Each builder gives
vet_addressesthe port of its whitelist entry. Thus the builders also refuse a cloud metadata name before the lookup, and a scoped IPv6 answer such as2606:4700::1%2. The public builder admitted that answer before. The builders continue to sort the address blocks, so the same answers give the same manifest.The docstring of each builder names its time-of-check gap. The NetworkPolicy holds the addresses of one lookup. A later lookup in the pod can give a different address. The policy does not allow that address, so the pod cannot connect to it.
A refusal of a whitelist builder is a
SandboxValidationError. It names the host, the refused answer when there is one, and the reason, and the refusal ofvet_addressesis its cause. The message ofSSRFBlockedErrormasks the host, so it does not tell the person which entry the builder refused. A failed lookup (httpcore2.ConnectError) changes into aSandboxValidationErrorin the same way. The refusals of an IP address or CIDR in the four builder functions also raiseSandboxValidationError, not a bareValueError.SandboxValidationErroris aValueError, sodevops sandbox network-policyexits 1 and prints no policy, as before.test_each_caller_dials_at_its_levelhas a row for the metrics scrape, with and withoutai.allow_private_network.test_a_scrape_looks_up_its_host_onceandtest_the_whitelist_policy_looks_up_each_name_oncecount the lookups.test_the_whitelist_policy_refuses_an_answer_outside_its_levelgives each builder a cloud metadata name, a cloud metadata answer, a scoped IPv6 answer and an answer outside its level, and the local builder also a link-local answer.test_a_whitelist_name_that_does_not_resolve_is_refusedandtest_network_policy_exits_1_naming_a_whitelist_name_whose_answer_it_refusescheck the error and the exit status. The swallowed-failures ceiling ofsandbox/metrics.pygoes down to 1. The new capabilitysandbox-egressholds the requirements.README.mdnames the sandbox metrics scrape among the clients of the egress-checked factory.Part 5 of the split (#2437) deletes
_resolve_host_ipsand_enforce_non_private_ssrf, changes the check of the container engine endpoint, and writes the general statement that every HTTP client is checked at the connect.Closes #2431
Change:
openspec/changes/archive/2026-10-28-2431-sandbox-vet-addresses/