Repository navigation
Description
What happened
The egress checks in src/devops_cli/core/validation.py (is_non_public_ip, _enforce_non_private_ssrf, validate_url) decide which addresses are non-public with a block list kept by hand in src/devops_cli/config/constants.py (CONST_PRIVATE_NETWORKS, from line 2547) and with hand-written handling of NAT64, Teredo, ISATAP and IPv4-embedding prefixes (CONST_NAT64_PREFIXES, CONST_TEREDO_PREFIX, CONST_ISATAP_INTERFACE_IDS, CONST_IPV4_EMBEDDING_IPV6_PREFIXES, CONST_LOW32_OFFSETS). The docstring of is_non_public_ip (line 393) says that the list mirrors "pydantic-ai's non-public blocks". In pydantic-ai 2.54.0 those blocks are in the private module pydantic_ai._ssrf, which has no API promise, so the copy can drift from upstream with each upgrade and nobody sees it. The test audit of 2026-10-24 found this.
The owner's rule: fixes use libraries, not home-grown IP code; a new hand-rolled helper is a major finding.
What should happen
The non-public test has one maintained source, and the code keeps no copy of another project's private code:
- Use a public, maintained API first: the standard library's
ipaddress(is_global, which follows the IANA special-purpose registries, andipv4_mapped,sixtofour,teredo), or a public SSRF API of pydantic-ai if one exists at the pinned version. Record the choice and the rejected options in the design. - Keep only the rules that the chosen source does not cover, each with a comment that names the RFC or the reason, and a test for each.
- refactor(security): the egress checks read legacy numeric hosts with getaddrinfo and AI_NUMERICHOST, and the hand-written ipv4 parser goes #2152 changes how legacy numeric hosts are read in the same module; deliver this after it, or merge the two if they touch the same lines.
Evidence
src/devops_cli/core/validation.py:393(the docstring),:599(_enforce_non_private_ssrf), and the constants listed above, at origin/main on 2026-10-24.python -c "import importlib.util; print(importlib.util.find_spec('pydantic_ai._ssrf'))"finds the private module in pydantic-ai 2.54.0.
Acceptance criteria
- No constant or docstring in
src/copies or mirrors a private module of another package. - A table test runs the classifier over the IPv4 and IPv6 special-purpose registries of IANA and over the NAT64, Teredo and IPv4-mapped forms of private addresses, and each answer agrees with the chosen source or with a rule that the code documents.
- The existing SSRF tests pass unchanged.
Source: #2152
Proposed design
Problem statement
The egress validation in src/devops_cli/core/validation.py classifies non-public IP addresses using a hand-kept block list in src/devops_cli/config/constants.py. This list mirrors the private module pydantic_ai._ssrf, which has no API guarantee. The copy can drift from upstream with each pydantic-ai upgrade. The owner's rule requires using maintained libraries, not home-grown IP code.
Acceptance criteria
- Criterion 1: No constant or docstring in
src/references or mirrors a private module of another package.
Verification: Rungrep -rn '_ssrf\|pydantic.ai.*non.public\|pydantic.ai.*private' src/and confirm zero matches. - Criterion 2: A table test covers every IPv4 and IPv6 IANA special-purpose registry plus NAT64, Teredo, and IPv4-mapped forms of private addresses.
Verification: Runpytest tests/ -k 'ssrf or non_public' -vand confirm the table includes an entry for each IANA registry and each transition mechanism. - Criterion 3: The existing SSRF tests pass without modification.
Verification: Runpytest tests/ -k 'ssrf or egress or non_public'and confirm all tests pass with no test file changes in the diff.
Key questions
- Which public API is the maintained source for non-public address classification?: The standard library
ipaddressmodule:is_global,ipv4_mapped,sixtofour, andteredoproperties. (proposed) - Does pydantic-ai 2.54.0 expose a public SSRF classification API?: No. The blocks live in the private module
pydantic_ai._ssrf, which has no API guarantee. [sources: src/devops_cli/core/validation.py:393] - Which rules remain that the stdlib
ipaddressdoes not cover?: The ISATAP interface-ID check (RFC 4214) and the IPv4-compatible low-32-bit check (RFC 4291) have no named property onIPv6Address. These two rules stay, each with a comment naming the RFC and a dedicated test. (proposed) - What is the delivery order relative to refactor(security): the egress checks read legacy numeric hosts with getaddrinfo and AI_NUMERICHOST, and the hand-written ipv4 parser goes #2152?: Deliver after refactor(security): the egress checks read legacy numeric hosts with getaddrinfo and AI_NUMERICHOST, and the hand-written ipv4 parser goes #2152, or merge the two if they touch the same lines. (proposed)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Alternatives check of 2026-11-02: not-applicable.
Class: refactor, no search.
Tool: none found.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 24, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
the candidate proposes to refactor the way SSRF checks are done by using a public API instead of hand-kept copies.this change improves security by removing reliance on private module copies that can drift from upstream.the change fixes a security issue where the code relies on outdated and unmaintained copies of another library's private API.requires replacing hand-rolled logic with a public API, updating tests, and ensuring compatibility with existing functionality.both items improve IP address classification; this one focuses on removing private module copies, while #1174 uses stdlib classes for classification.dan-petty commentedon Oct 27, 2026
Status set to Ready at 0abf552 (see proposed design in issue body).
devops-cli-service commentedon Nov 2, 2026
Staged: branch
refactor/2184-the-egress-checks-take-their-non, draft pull request #3156. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
devops-cli-service commentedon Nov 2, 2026
Alternatives check: not-applicable
Class: refactor. The check makes no search and no model call for an item of this class.
Tool: none found
Checked on 2026-11-02. A person decides what this means for the item. The check changes no label and closes no issue.
docs(openspec): fix plan #2184 keep NAT64 and the range list
docs(openspec): plan #2184 Use ipaddress for single-address egress ch…
devops-cli-service commentedon Nov 4, 2026
Released in v0.56.5: https://github.com/dan-petty/devops-cli/releases/tag/v0.56.5
devops-cli-service commentedon Nov 4, 2026
Live since 2026-11-04 23:38 UTC