Skip to content

test(security): no committed file holds a private address or a .lan host - #2597

Merged
dan-petty merged 2 commits into
mainfrom
test/1977-private-address-check
Oct 29, 2026
Merged

dan-petty merged 2 commits into
mainfrom
test/1977-private-address-check

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

SECURITY.md rule 8 forbids an RFC 1918 address and an internal .lan host in a committed file, but no check held the rule.

  • tests/invariants/test_committed_addresses.py reads each tracked file, parses each run of address characters with ipaddress (no octet pattern), and fails on an RFC 1918 host address or a .lan host.
  • A range in CIDR form and three named upstream values (minikube node, AKS DNS service, OpenTelemetry example) pass.
  • Test code, archived OpenSpec changes and CHANGELOG.md are out of scope: the egress and reference classifier tests need RFC 1918 input, archives record merged work, and release-please writes the changelog.
  • The two living specs, the five tests that feed them and one docstring move to RFC 5737 addresses. SECURITY.md names the check.

Closes #1977

Change: openspec/changes/archive/2026-10-29-1977-private-address-check/

A new invariant test reads each tracked file, parses each run of
address characters with `ipaddress`, and fails on an RFC 1918 host
address or a `.lan` host (SECURITY.md rule 8). A range in CIDR form and
three named upstream defaults pass. Test code, archived OpenSpec changes
and CHANGELOG.md are out of scope.

The specs configured-service-urls and stack-credential-sync, the five
tests that feed them and a reference_extractor docstring move to
RFC 5737 addresses. SECURITY.md names the check.
@dan-petty

Copy link
Copy Markdown
Owner Author

Test evidence:

  • Before the fixes, the tree scan failed on the 10 in-scope RFC 1918 host addresses of origin/main 4011680: 9 in the living specs configured-service-urls and stack-credential-sync, and 1 in a security/reference_extractor.py docstring. After the archive, uv run pytest tests/invariants/test_committed_addresses.py: 26 passed (the scan and 25 unit cases).
  • Counts on origin/main by scope (values not shown): in scope, 10 host addresses (fixed), 26 ranges and 6 upstream values (allowed); test code, 98 host addresses, 25 ranges, 9 upstream values and 4 .lan hosts; archived changes, 14; CHANGELOG.md, 2.
  • The five tests that feed the changed scenarios pass with 192.0.2.10: 279 tests in their files. After the rebase onto 4011680, 305 tests passed in the six affected files.
  • tests/invariants, tests/test_architectural_invariants.py and tests/test_test_selection.py pass with the new module. Ruff, mypy, devops docs check and openspec validate pass.
  • The tree scan takes 0.78 s here.

Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD).

@dan-petty
dan-petty marked this pull request as ready for review October 29, 2026 02:18
@dan-petty
dan-petty merged commit a95992a into main Oct 29, 2026
16 checks passed
@dan-petty
dan-petty deleted the test/1977-private-address-check branch October 29, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(security): no committed file holds a private IP address or an internal .lan host

1 participant