Repository navigation
refactor(security): ask ipaddress for single-address egress checks - #3540
Merged
Merged
Conversation
The single-address egress check took its blocks from a hand-kept list that copied the private module pydantic_ai._ssrf. It now asks ipaddress (is_global, is_multicast) and keeps only the rules that ipaddress lacks: NAT64, IPv4-compatible, ISATAP and the block 192.0.0.0/24. A table test pins the answers over the IANA special-purpose registries.
Owner
Author
|
Test results (local, before push):
|
dan-petty
marked this pull request as ready for review
November 4, 2026 23:13
dan-petty-release Bot
added a commit
that referenced
this pull request
Nov 4, 2026
🤖 I have created a release *beep* *boop* --- ## [0.56.5](v0.56.4...v0.56.5) (2026-11-04) ### Code Refactoring * **security:** ask ipaddress for single-address egress checks ([#3540](#3540)) ([4485be2](4485be2)) --- 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 single-address egress check tells a public address from a non-public one. It used a block list that copied the private module
pydantic_ai._ssrf. That module has no API promise, so the copy could drift with each upgrade.The check now asks Python's
ipaddress(is_global,is_multicast) about each address and about each IPv4 address that it embeds. The code keeps only the rules thatipaddresslacks, each with an RFC comment: NAT64, IPv4-compatible, ISATAP and the whole block 192.0.0.0/24. The Teredo client comes fromIPv6Address.teredo.CONST_PRIVATE_NETWORKSstays for the overlap test of a range. A table test over the IANA registries holds each block tois_global.No answer of
is_non_public_ipchanges.Closes #2184
Change:
openspec/changes/archive/2026-11-04-2184-the-egress-checks-take-their-non/