Skip to content

proxy registry: attach the token over http only to private hosts or with an explicit opt-in - #4317

Merged
Daniel Meppiel (danielmeppiel) merged 17 commits into
mainfrom
danielmeppiel-s16-proxy-http-token
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 17 commits into
mainfrom
danielmeppiel-s16-proxy-http-token

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

PROXY_REGISTRY_TOKEN is sent over http:// only to a loopback or RFC 1918 private host (10/8, 172.16/12, 192.168/16), or when PROXY_REGISTRY_ALLOW_HTTP=1 explicitly authorizes it. Otherwise the token is not sent, and a [!] line names the (redacted) URL and the opt-in. https:// is unchanged.

  • Decision owner: deps/registry_proxy.http_token_allowed, consumed by RegistryConfig.from_env; host classification: utils/net.is_local_network_host (loopback plus RFC 1918), part of the credential-origin-scope owner.
  • PROXY_REGISTRY_ALLOW_HTTP=1 now authorizes sending the token over http:// to other hosts (documented in enterprise/registry-proxy.md and reference/environment-variables.md).
  • New closed-world guard transport-platform-proxy-http-token: one decision function, one consumer, and no other module reads the opt-in. One sorted MutationCase.

Issue and approved scope

Issue: Fixes #4314

Human scope-approval comment: #4314 (comment)

Does this PR complete the issue, or what remains? It completes the issue.

Type of change

  • Bug fix
  • Documentation

Testing

  • Tested locally

  • All existing tests pass (CI pending)

  • Added tests for new functionality (if applicable)

  • pytest tests/unit/test_artifactory_support.py tests/unit/utils/test_credential_rendering.py -k "http_url or proxy_plaintext or local_network" -> 14 passed

  • pytest tests/quality/test_lifecycle_bug_ledger.py -> 2 passed

  • pytest tests/integration/test_proxy_registry_http_token_lifecycle.py tests/integration/test_registry_credential_origin_lifecycle.py (installed CLI, header capture) -> 6 passed

  • guard clean on this branch; the mutation case is caught

  • ruff check / ruff format --check (0.15.12) on changed files -> clean

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.

…r with an explicit opt-in

PROXY_REGISTRY_TOKEN travels over http:// only to a loopback or RFC 1918
private host, or when PROXY_REGISTRY_ALLOW_HTTP=1 authorizes it. Otherwise
the token is not sent and a [!] line names the URL and the opt-in.
utils/net.is_local_network_host classifies the host.

Guard: transport-platform-proxy-http-token (one mutation case).

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
Copilot AI balanced review requested due to automatic review settings November 20, 2026 12:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A critical leading-zero IP parsing mismatch can expose bearer tokens outside permitted networks, and the required installed-CLI regression for token transmission and warnings is missing.

2 open issues
What changed in this PR

This PR tightens proxy-registry authentication for #4314: HTTP token transmission is limited to loopback or RFC 1918 hosts unless PROXY_REGISTRY_ALLOW_HTTP=1 explicitly permits it.

Changes:

  • Centralizes the token decision and adds a redacted warning when the token is withheld.
  • Adds unit regressions, an architecture guard, a mutation case, and a bug-ledger entry.
  • Documents the opt-in’s changed meaning and the authentication behavior.
File Description
tests/​unit/​utils/​test_credential_rendering.py Updates warning-redaction tests for console output.
tests/​unit/​test_artifactory_support.py Tests token withholding, private hosts, opt-in, and HTTPS.
tests/​unit/​scripts/​test_architecture_runner.py Registers the guard in the expected rule inventory.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds a mutation that bypasses the token decision.
tests/​fixtures/​lifecycle_bug_ledger.json Records #4314 and its regression tests.
src/​apm_cli/​utils/​net.py Adds loopback and RFC 1918 host classification.
src/​apm_cli/​deps/​registry_proxy.py Enforces the HTTP token policy and emits warnings.
src/​apm_cli/​deps/​artifactory_orchestrator.py Clarifies the transport docstring; no functional change.
scripts/​architecture_linter/​groups/​transport_platform.py Includes the new guard in the transport group.
scripts/​architecture_linter/​checks/​transport_proxy_http_token.py Adds ownership checks for the token decision and opt-in.
docs/​src/​content/​docs/​reference/​environment-variables.md Updates the HTTP opt-in reference.
docs/​src/​content/​docs/​enterprise/​registry-proxy.md Explains allowed hosts and token withholding.
CHANGELOG.md Records the user-visible authentication change.
.apm/​architecture/​owners/​transport-auth-platform.json Extends credential ownership and registers the guard.

Review effort: Balanced

Comment thread src/apm_cli/utils/net.py Resolved
Comment thread tests/unit/test_artifactory_support.py Resolved
Integer, hexadecimal and leading-zero host forms are read differently by
socket resolvers, so they never qualify for the private-network exception.

Co-authored-by: Copilot App <[email protected]>
…equest-header capture

The header capture proxy also records plain-HTTP requests for its
configured hosts.

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
…erer form; parse URLs in tests

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	.apm/architecture/owners/transport-auth-platform.json
#	docs/src/content/docs/enterprise/registry-proxy.md
#	docs/src/content/docs/reference/environment-variables.md
#	tests/unit/test_artifactory_support.py
… transport_platform RULES, bug ledger)

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	scripts/architecture_linter/groups/transport_platform.py
#	tests/fixtures/lifecycle_bug_ledger.json
…en' into s16

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 8990a06 into main Nov 21, 2026
37 of 44 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-s16-proxy-http-token branch November 21, 2026 05:24
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
registries.<name>.url acceptance now delegates its loopback / RFC 1918
host decision to utils/net.py is_local_network_host (#4317), so one owner
classifies local-network hosts. The RFC 1918 edge tests (10.x, 172.16.x,
192.168.x accepted; 172.15.255.255 and 172.32.0.1 refused) stay the oracle.
The registry URL scheme guard now requires the delegation.

apm-spec-waiver: req-sc-006 behaviour unchanged; host classification moves to its shared owner

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
registries.<name>.url acceptance now delegates its loopback / RFC 1918
host decision to utils/net.py is_local_network_host (#4317), so one owner
classifies local-network hosts. The RFC 1918 edge tests (10.x, 172.16.x,
192.168.x accepted; 172.15.255.255 and 172.32.0.1 refused) stay the oracle.
The registry URL scheme guard now requires the delegation.

apm-spec-waiver: req-sc-006 behaviour unchanged; host classification moves to its shared owner

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
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.

proxy registry: attach the token over http only to private hosts or with an explicit opt-in

2 participants