Skip to content

Owner moves: one registry URL scheme owner; registries keys validated under both contracts - #4304

Closed
Daniel Meppiel (danielmeppiel) wants to merge 16 commits into
mainfrom
danielmeppiel-h-a2-registry-url-scheme
Closed

Daniel Meppiel (danielmeppiel) wants to merge 16 commits into
mainfrom
danielmeppiel-h-a2-registry-url-scheme

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Part of the 0.37 trust and integrity consistency hardening (owner consolidation):

  • Registry URLs are validated against the spec scheme rules (req-sc-006), through one scheme-acceptance owner (deps/registry/url_scheme.py), under both manifest contracts and for the workspace manifest. Local hosts are decided by the shared network-host owner (utils/net.py).
  • registries.<name> key validation (req-mf-015): a mistyped key is rejected, naming the key and the registry, and an x- vendor key is accepted, under both manifest contracts.
  • Closed-world guard install-deployment-registry-url-scheme (every function that reads a registries URL asks the owner) with one mutation case; owner-registry entry registry-url-scheme.

Replaces the scope #4259 was meant to carry (it merged with only the #4151 merge).

Issue and approved scope

Fixes #4286 -- scope record: #4286 (comment)
Fixes #4252 -- scope record: #4252 (comment)

Completes both issues.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Installed CLI (red before, green after):
tests/integration/test_registry_url_scheme_lifecycle.py -- before the fix 3 failed / 5 passed; after: 8 passed.
Parse-time, both contracts: tests/unit/test_apm_yml_registries.py::TestRegistryUrlScheme, ::TestRegistryEntryKeys -- before 14 failed; after all passed.
Spec conformance: tests/spec_conformance/test_manifest_behavior_reqs.py::test_http_registry_url_needs_local_host_or_insecure (new, req-sc-006); the strict xfail for #4252 (test_registry_entry_rejects_typos_but_keeps_vendor_keys) now passes and is unmarked.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: N/A, implements existing req-sc-006 / req-mf-015 text.
  • Manifest edit: N/A.
  • Test edit: @pytest.mark.req("req-sc-006") behavior test added; req-mf-015 behavior test un-xfailed.
  • CONFORMANCE.{md,json} regenerated (follow-up commit if the drift check asks for it).

…#4286)

One scheme-acceptance owner (deps/registry/url_scheme.py) decides whether a
registries.<name>.url is accepted, under both manifest contracts and for the
workspace manifest, per req-sc-006. registries.<name> entries reject a
mistyped key and ignore x- extension keys under both contracts (#4252,
req-mf-015). Closed-world guard install-deployment-registry-url-scheme with
one mutation case; ledger rows for #4286 and #4252.

Co-authored-by: Copilot App <[email protected]>

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

Malformed-URL diagnostics can leak embedded passwords, committed conformance artifacts are stale and cause CI failure, and the architecture guard misses subscript-based URL reads that bypass validation.

3 open issues
What changed in this PR

Centralizes registry URL validation and aligns registry-entry key handling across APM’s two manifest contracts, addressing #4286 and #4252.

Changes:

  • Adds a shared URL-scheme validator for project manifests and workspace registry loading.
  • Rejects unknown registry-entry keys while accepting vendor extensions under both contracts.
  • Adds architecture enforcement, regression coverage, and documentation.
File Description
tests/​unit/​test_apm_yml_registries.py Tests URL acceptance and registry-key validation across both contracts.
tests/​unit/​scripts/​test_architecture_runner.py Registers the new guard in the expected rule inventory.
tests/​spec_conformance/​test_manifest_behavior_reqs.py Adds scheme conformance cases and removes the registry-key expected failure.
tests/​integration/​test_registry_url_scheme_lifecycle.py Exercises installed-CLI acceptance and rejection without state changes.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds a mutation that removes scheme-owner validation.
tests/​fixtures/​lifecycle_bug_ledger.json Records both defects and their regression coverage.
src/​apm_cli/​models/​apm_package.py Routes both parsers through shared scheme and key validation.
src/​apm_cli/​deps/​registry/​url_scheme.py Defines the shared registry URL-scheme validator.
src/​apm_cli/​deps/​registry/​config_loader.py Omits workspace registry URLs rejected by the validator.
scripts/​architecture_linter/​checks/​install_registry_url_scheme.py Adds an ownership guard for registry URL readers.
scripts/​architecture_linter/​checks/​install_deployment_analyzers.py Registers the scheme-ownership guard.
packages/​apm-guide/​.apm/​skills/​apm-usage/​dependencies.md Documents scheme restrictions and extension-key handling.
docs/​src/​content/​docs/​reference/​registries.md Clarifies parse-time rules versus transport restrictions.
docs/​src/​content/​docs/​reference/​manifest-schema.md Documents insecure and vendor-extension keys.
CHANGELOG.md Records the two user-visible validation changes.
.apm/​architecture/​owners/​install-deployment.json Declares the URL-scheme owner, consumers, and guard.

Review effort: Balanced

Comment thread src/apm_cli/deps/registry/url_scheme.py Resolved
…wner (#4286)

apm config set registry.<name>.url, the config.json registry reader and the
registry credential binding ask deps/registry/url_scheme.py; the closed-world
guard covers the user-config readers. Installed-CLI case for config set.
CHANGELOG refs (#4304); CONFORMANCE regenerated for the req-sc-006 test.

Co-authored-by: Copilot App <[email protected]>
A diagnostic from the scheme owner names the registry and, at most, the
host; it never echoes the configured URL, which can carry credentials.

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
…al owner

Registry URL scheme diagnostics show the URL only through
redact_url_userinfo; the credential-rendering guard follows the check
into deps/registry/url_scheme.py. apm config set registry.<name>.<field>
moves to a helper (complexity), and its refusal renders through
redact_secrets. The registry URL scheme guard skips the display-only
apm config listing.

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	CONFORMANCE.json
#	CONFORMANCE.md
#	tests/fixtures/lifecycle_bug_ledger.json
… CONFORMANCE

The mutation replaces the owner call with None (one line) instead of
deleting the check. CONFORMANCE regenerated after merging main.

Co-authored-by: Copilot App <[email protected]>
…w lifecycle module

The strict xfails for #4286 and the default-contract insecure field now
pass and are unmarked; the duplicate req-sc-006 test in the manifest
module is dropped in favour of them. The registry URL scheme lifecycle
module names its promises.

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
…ce file

Accepted-registry cases assert that no registry diagnostic is printed; the
workspace reader case asserts the file is left unchanged (assertion
quality ratchet AQ003).

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
…ries keys validated under both contracts

Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
http to 172.32.0.1 and 172.15.255.255 is refused at parse under both
manifest contracts; 10.x, 172.16.x and 192.168.x stay accepted.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
…ries keys validated under both contracts

Co-authored-by: Copilot App <[email protected]>
…heme

# Conflicts:
#	CONFORMANCE.json
#	CONFORMANCE.md
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Closing as superseded: this change shipped in v0.37.0 through the release train (#4424). Its core source and test files are byte-identical on main, and the linked issues are closed as completed in 0.37.0. The only remaining differences are in shared files that every train PR touches (CHANGELOG, bug ledger, owner registry). Nothing is left to land. -- regent, 0.37 milestone close-out

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.

registries: validate URL scheme per spec [BUG] registries.<name> entries: typo keys accepted under the v0.1 contract, x- keys rejected otherwise

2 participants