Skip to content

fix(auth): route every Azure DevOps egress through one auth chain owner - #3790

Merged
Daniel Meppiel (danielmeppiel) merged 16 commits into
mainfrom
danielmeppiel-0361-t1-pr1-auth-owner
Nov 18, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 16 commits into
mainfrom
danielmeppiel-0361-t1-pr1-auth-owner

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

fix(auth): route every Azure DevOps egress through one auth chain owner

TL;DR — AuthResolver.try_with_fallback is now the only way an authenticated request reaches a Git host. A new classifier (core/auth_outcome.py) decides what counts as an auth failure, and a new chain (core/auth_chain.py) walks ADO_APM_PAT → az bearer → path-scoped git credential fill for every Azure DevOps operation. Users without a PAT or az session can now install from Azure DevOps and read ADO-hosted org policy through Git Credential Manager, and az failures report their real cause.

Note

No live Azure DevOps organization was available. Behavior follows the documented Azure DevOps, Git credential and GCM contracts and is validated by hermetic unit tests and installed-binary lifecycle scenarios (local HTTPS proxy impersonating dev.azure.com with real git http-backend; no network).

Problem (WHY)

Approach (WHAT)

Decision Owner
Auth-outcome classification (401/403, sign-in redirect, 200/203 HTML sign-in page, Git auth stderr; network/TLS/throttle/not-found never escalate) core/auth_outcome.py::classify_auth_outcome
Chain entry AuthResolver.try_with_fallback (new remote_url= and attempts= kwargs)
ADO chain order + attempt log core/auth_chain.py::run_ado_chain, ADO_SERVICES_CHAIN / ADO_SERVER_CHAIN, AuthAttemptLog
Helper credential record core/token_manager.py::GitHelperCredential (host, port, path, username, password)
Header per attempt AuthResolver._build_git_env (only formatter); HTTP reuses it via http_authorization_headers / AttemptAuth

Call sites now report raw outcomes (raise AuthAttemptFailed(response=…) or let Git errors propagate); they never classify.

Implementation (HOW)

Area Change
core/auth.py ADO branch delegates to run_ado_chain; execute_with_bearer_fallback, BearerFallbackOutcome, build_ado_bearer_git_env removed; is_public_github_auth_failure is a classifier wrapper; outcome-reported failures escalate only when classified as auth; build_error_context(attempts=…) renders #3753; helper cache per (host, port, path); ADO children get no echo askpass on POSIX. 2007 → 1820 lines.
core/auth_outcome.py (new) AuthOutcomeKind (ok, auth_required, credential_rejected, not_found, throttled, network, tls, other), AuthOutcome, AuthAttemptFailed, frozen ADO_SIGNIN_HOSTS, redact_secrets (token-shaped values only after whitespace), sanitize_diagnostic_detail (ASCII, redacted, picks the AADSTS line).
core/auth_chain.py (new) Chain table, run_ado_chain, AuthAttemptLog, AdoAuthChainExhaustedError(attempts=…), HelperCredentialCache (singleflight), ado_helper_path (org/project/_git/repo), authorization_headers, AttemptAuth (explicit auth= hook → no ambient netrc).
core/token_manager.py resolve_git_helper_credential keeps username + scope; credential_fill_env sets GCM_INTERACTIVE=0 when stdin is not a TTY or CI is set.
core/azure_cli.py last_error kept on the provider; tenant lookup cached (≤1 az account show).
Routed sites install/validation.py, install/pipeline.py, deps/github_downloader_validation.py, deps/clone_engine.py, deps/git_reference_resolver.py, deps/download_strategies.py::download_ado_file (allow_netrc=False), marketplace/ref_resolver.py, marketplace/client.py::_fetch_ado_rest, policy/discovery.py (ADO + GitHub with org=owner per-org PAT), policy/_gitlab.py.
Guard New scripts/architecture_linter/checks/transport_auth_outcome.py → transport-platform-auth-outcome-owner, registered on host-credential-resolution; one sorted MutationCase. Existing host-credential needles retargeted to the chain.
Docs getting-started/authentication.md, apm-guide/.../authentication.md, auth skill, CHANGELOG.

Diagram

Every ADO operation enters the owner once; each step runs only after the classifier reports an auth failure.

flowchart LR
    S["Call site: validation / clone / refs / preflight / download / policy / marketplace"] --> T["AuthResolver.try_with_fallback"]
    T --> P["ADO_APM_PAT or resolved bearer"]
    P -->|"auth failure"| B["az CLI bearer (Services only)"]
    B -->|"auth failure or no token"| H["git credential fill (org/project/_git/repo)"]
    H -->|"auth failure or none"| X["AdoAuthChainExhaustedError + AuthAttemptLog"]
    P -->|"network / TLS / not found"| R["re-raise unchanged"]
    C["classify_auth_outcome"] -.->|"decides every edge"| T
Loading

Trade-offs

  • 403 escalates (D5a). Over-escalation costs one cached helper call; under-escalation is the bug class.
  • No X-TFS-FedAuthRedirect (D4a) — the classifier handles 302/203 instead; the header is not documented.
  • No git credential approve/reject (D3a) — APM never mutates the user's store; a misclassified rejection cannot erase a credential. Guarded statically.
  • GitHub-class chains keep escalate-on-any-exception for arbitrary operation errors; only AuthAttemptFailed outcomes are classified, to avoid regressing GitHub/GitLab callers in a patch release.
  • Canonical-target policy cells in the RT1 policy lifecycle are xfail(strict=False) — they depend on T2 (compilation-target policy check ignores the plural targets: key #3732), not on auth.

Benefits

  1. ADO install/update/--frozen/-g/APM_HOME succeed with only GCM configured (lifecycle-proven).
  2. ADO-hosted org policy is found after a sign-in redirect; compile/uninstall lifecycle scripts run under fetch_failure_default: block.
  3. az failures show the AADSTS reason and az login; at most one az account show per run.
  4. The exhausted error lists ADO_APM_PAT, az CLI bearer, git credential fill in order with each outcome.
  5. One classifier and one entry point, enforced by a mutation-tested guard: a new call site cannot regrow its own auth decision.

Issue and approved scope

Issue: Fixes #3752, Fixes #3758, Fixes #3753

Human scope-approval comments:

This PR completes all three. Out of scope (separate PRs): the origin-bounded redirect owner for registries/marketplace builder (#3726, PR 2) and the broad egress guard plus lint-auth-signals cleanup (PR 3).

Type of change

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

Testing

  • Tested locally
  • All existing tests pass (targeted suites below; full suites run in CI)
  • Added tests for new functionality

Validation

Regression tests were written first and failed on unmodified code (8/8):

Pre-fix run of tests/unit/core/test_ado_auth_chain_regressions.py
FAILED ...::test_policy_signin_redirect_escalates_to_path_scoped_helper   ('Refusing HTTP redirect (302) ... _signin')
FAILED ...::test_download_signin_page_escalates_to_helper_basic_with_username   (RuntimeError: Azure DevOps returned a sign-in page)
FAILED ...::test_download_ignores_ambient_netrc_for_ado   (netrc credential sent instead of ADO_APM_PAT)
FAILED ...::test_validation_ls_remote_escalates_to_helper   (AuthenticationError)
FAILED ...::test_helper_fill_runs_once_per_repository_under_concurrency   (8 fills, expected 1)
FAILED ...::test_credential_fill_disables_gcm_interaction_in_ci   (GCM_INTERACTIVE unset)
FAILED ...::test_error_context_reports_az_failure_reason_not_rejection   ("returned a bearer token ... rejected it (HTTP 401)")
FAILED ...::test_secret_redaction_keeps_bearer_token_phrase   ('ADO [REDACTED] acquisition failed')
8 failed in 2.82s
Post-fix results (all commands run locally, -p no:xdist)
Command Result
pytest tests/unit/core/test_ado_auth_chain_regressions.py tests/unit/core/test_auth_outcome.py 32 passed
Targeted auth/deps/install/marketplace/policy unit suites (40 files) 3067 passed, 2 skipped, 1 xfailed
pytest tests/unit/marketplace tests/unit/test_install_command.py tests/unit/install/test_validation_ado_bearer.py 2062 passed
Auth-related integration + architecture suites (16 files) 637 passed
pytest tests/integration/test_architecture_owner_rule_mutations.py tests/unit/scripts/test_architecture_runner.py (+ ADO/MCP/host-identity architecture tests) 753 passed (2 stale needles fixed, then 36/36 re-run)
APM_BINARY_PATH=.venv/bin/apm pytest tests/integration/test_ado_credential_helper_install_lifecycle.py 9 passed
APM_BINARY_PATH=.venv/bin/apm pytest tests/integration/test_ado_policy_signin_redirect_lifecycle.py tests/integration/test_azure_cli_failure_diagnostic_lifecycle.py tests/integration/test_github_credential_scope_lifecycle.py 10 passed, 6 xfail (T2 #3732)
pytest tests/quality · check_test_assertions.py · check_exact_test_duplicates.py 161 passed · clean · clean
uvx [email protected] check / format --check (CI paths) All checks passed / 2319 formatted
pylint --enable=R0801 ... 10.00/10
bash scripts/lint-auth-signals.sh · bash scripts/lint-architecture-boundaries.sh clean · clean
File-length (2100) and relative_to guards clean

Scenario evidence

User scenario Proof Principle
apm install <ado-url> with no PAT/no az, GCM has a credential (brief sc. 1) test_ado_cli_install_uses_credential_helper_without_pat_or_az Secure by default
Manifest install → --frozen → outdated → update, -g, APM_HOME (sc. 2) test_ado_manifest_install_frozen_update_outdated_through_credential_helper, test_ado_user_scope_install_through_credential_helper Reproducible
policy status --no-cache, compile, uninstall with ADO policy behind _signin redirect (sc. 3) test_policy_status_follows_signin_redirect_into_credential_helper, test_compile_/test_uninstall_lifecycle_runs_when_ado_policy_needs_credential_helper Governed
az fails with AADSTS50076 (sc. 4) test_azure_cli_token_failure_reports_aadsts_cause_not_a_rejected_token Actionable errors
Helper empty → steps listed in order (sc. 7) test_ado_exhausted_chain_names_every_step_in_order Actionable errors
CI=1 → GCM_INTERACTIVE=0 (sc. 8) test_ado_noninteractive_credential_fill_disables_helper_ui_in_ci Non-interactive safety
PAT keeps precedence; ambient netrc never replaces the chain credential test_ado_pat_keeps_precedence_over_credential_helper, test_ado_resolved_credential_is_not_replaced_by_ambient_netrc Secure by default
GitHub org policy with GITHUB_APM_PAT_<ORG> test_github_policy_discovery_uses_org_scoped_credential Governed

How to test

  • uv run pytest tests/unit/core/test_ado_auth_chain_regressions.py tests/unit/core/test_auth_outcome.py -p no:xdist
  • APM_E2E_TESTS=1 APM_BINARY_PATH=$PWD/.venv/bin/apm uv run pytest tests/integration/test_ado_credential_helper_install_lifecycle.py -p no:xdist
  • bash scripts/lint-architecture-boundaries.sh — then reintroduce if response.status_code in (401, 403): in policy/discovery.py::_fetch_ado_contents and watch transport-platform-auth-outcome-owner fire.

Spec conformance (OpenAPM v0.1)

  • Spec edit
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json} regenerated
  • N/A -- this PR does not change OpenAPM-observable behaviour.

Co-authored-by: Copilot [email protected]

AuthResolver.try_with_fallback is now the single entry for authenticated
host access. A new core/auth_outcome.py owns auth-outcome classification
(401/403, a redirect to the ADO sign-in service, an HTML sign-in page, Git
auth errors) and core/auth_chain.py walks ADO_APM_PAT -> az bearer ->
path-scoped git credential fill, recording an AuthAttemptLog that
diagnostics render.

- Route install validation, clone, ref resolution, install --update
  preflight, ADO file downloads, org policy discovery (ADO, GitHub with
  per-org PAT, GitLab) and marketplace REST/ref paths through the chain.
- Helper credentials keep their username (GitHelperCredential) and are
  sent as Basic username:password, cached per (host, port, path).
- git credential fill sets GCM_INTERACTIVE=0 when stdin is not a TTY or
  CI is set; APM never calls credential approve/reject.
- Azure DevOps requests use only the credential chosen by the auth chain.
- #3753: az token failures show the Azure CLI reason; the exhausted chain
  lists every step in order; "bearer token" is no longer redacted.
- Remove execute_with_bearer_fallback; is_ado_auth_failure_signal and
  is_public_github_auth_failure become thin classifier wrappers.
- Static guard transport-platform-auth-outcome-owner on the
  host-credential-resolution owner record, with a mutation case.

No live Azure DevOps organization was available: behavior follows the
documented contracts and is validated by hermetic tests.

Fixes #3752
Fixes #3758
Fixes #3753

apm-spec-waiver: auth chain owner refactor with no spec surface change

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

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

Unresolved redirect handling and legacy-host credential scoping can prevent credential-helper authentication, while a tenant-cache race permits redundant concurrent Azure CLI calls.

4 open issues
What changed in this PR

This PR centralizes Azure DevOps authentication across APM’s install, policy and marketplace flows to address #3752, #3758 and #3753. It adds repository-scoped credential-helper fallback and preserves Azure CLI token-acquisition errors for diagnostics.

Changes:

  • Routes Azure DevOps operations through one credential chain and shared outcome classifier.
  • Preserves helper usernames and repository scope, suppresses ambient netrc credentials on Azure DevOps HTTP paths, and improves failure reporting.
  • Adds regression fixtures, lifecycle coverage, architecture guards and authentication documentation.
File Description
tests/​utils/​simulated_ado_chain.py Adds shared auth-chain test doubles.
tests/​utils/​local_ado_org_fixture.py Simulates Azure DevOps and credential helpers.
tests/​unit/​test_list_remote_refs.py Migrates ref-listing mocks to the chain API.
tests/​unit/​test_auth.py Updates bearer fallback and exhaustion assertions.
tests/​unit/​scripts/​test_architecture_runner.py Registers the new guard in the expected inventory.
tests/​unit/​policy/​test_discovery.py Updates policy authentication tests.
tests/​unit/​policy/​test_discovery_policy_resolution.py Removes tests for the deleted token helper.
tests/​unit/​policy/​test_discovery_phase3w4.py Removes obsolete token-helper coverage.
tests/​unit/​policy/​test_cache_merged_effective.py Adapts cache tests to resolver-based authentication.
tests/​unit/​marketplace/​test_ref_resolver.py Checks SSH bypasses the credential chain.
tests/​unit/​marketplace/​test_client_ado.py Tests chain-selected headers and helper scope.
tests/​unit/​install/​test_validation_proxy.py Removes obsolete bearer-fallback mocks.
tests/​unit/​install/​test_validation_ado_bearer.py Exercises validation fallback and attempt diagnostics.
tests/​unit/​install/​test_pipeline_auth_preflight.py Tests preflight chain routing and exhaustion.
tests/​unit/​install/​phases/​test_resolve_ref_resolver_reuse.py Adapts ref-resolution authentication doubles.
tests/​unit/​deps/​test_github_downloader_input_validation.py Checks validation reuses the successful credential.
tests/​unit/​deps/​test_git_reference_resolver.py Updates ref-listing chain coverage.
tests/​unit/​deps/​test_download_strategies_selection.py Uses the shared simulated chain.
tests/​unit/​deps/​test_download_strategies_phase3.py Migrates download fallback tests.
tests/​unit/​deps/​test_clone_engine_bearer_env.py Checks bearer retry environment preservation.
tests/​unit/​deps/​test_clone_connect_retry.py Keeps connection retries within chain attempts.
tests/​unit/​core/​test_auth_validation.py Removes tests for deleted fallback APIs.
tests/​unit/​core/​test_auth_phase3.py Updates helper records and exhaustion diagnostics.
tests/​unit/​core/​test_auth_outcome.py Adds classifier and helper-scope contracts.
tests/​integration/​test_marketplace_ado_rest.py Captures headers applied by the auth hook.
tests/​integration/​test_github_credential_scope_lifecycle.py Covers org-scoped GitHub policy credentials.
tests/​integration/​test_git_reference_resolver_resolution.py Updates chain routing and diagnostic coverage.
tests/​integration/​test_commands_auth_flow.py Removes obsolete fallback-result tests.
tests/​integration/​test_azure_cli_failure_diagnostic_lifecycle.py Covers Azure CLI failure reasons and redaction.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds and retargets auth-boundary mutations.
tests/​integration/​test_ado_preflight_bearer_fallback_e2e.py Updates a comment to name the new chain API.
tests/​integration/​_ado_auth_kit.py Adds a shared Azure DevOps lifecycle harness.
tests/​fixtures/​lifecycle_bug_ledger.json Links reported bugs to regression scenarios.
src/​apm_cli/​utils/​github_host.py Delegates legacy auth detection to the classifier.
src/​apm_cli/​policy/​discovery.py Routes policy fetches through authentication chains.
src/​apm_cli/​policy/​_gitlab.py Reports raw HTTP outcomes to the auth owner.
src/​apm_cli/​marketplace/​ref_resolver.py Routes Azure DevOps ref probes through the chain.
src/​apm_cli/​marketplace/​client.py Uses chain-selected authentication for REST reads.
src/​apm_cli/​install/​validation.py Runs Azure DevOps validation through the chain.
src/​apm_cli/​install/​pipeline.py Integrates the chain into update preflight.
src/​apm_cli/​deps/​github_downloader_validation.py Routes ref validation through shared authentication.
src/​apm_cli/​deps/​git_reference_resolver.py Integrates chain-based ref and tag lookup.
src/​apm_cli/​deps/​download_strategies.py Adds chain-based Azure DevOps file downloads.
src/​apm_cli/​deps/​clone_engine.py Replaces clone-specific bearer fallback.
src/​apm_cli/​deps/​bare_cache.py Includes exhausted-chain details in clone errors.
src/​apm_cli/​core/​token_manager.py Preserves helper credentials and controls interaction.
src/​apm_cli/​core/​azure_cli.py Retains acquisition errors and caches tenant lookup.
scripts/​lint-auth-signals.sh Retargets checks to the chain entry point.
scripts/​architecture_linter/​groups/​transport_platform.py Includes the auth-outcome guard.
scripts/​architecture_linter/​checks/​transport_auth_platform.py Updates routing and netrc-isolation checks.
scripts/​architecture_linter/​checks/​transport_auth_outcome.py Adds classifier and chain-ownership enforcement.
packages/​apm-guide/​.apm/​skills/​apm-usage/​authentication.md Documents fallback behavior and remediation.
docs/​src/​content/​docs/​getting-started/​authentication.md Explains shared authentication and diagnostics.
CHANGELOG.md Records authentication and policy-fetch changes.
.apm/​skills/​auth/​SKILL.md Updates maintained authentication guidance.
.apm/​architecture/​owners/​transport-auth-platform.json Registers chain and classifier ownership.
.agents/​skills/​auth/​SKILL.md Synchronizes agent-facing authentication guidance.

Review effort: Balanced

Comment thread src/apm_cli/core/auth_chain.py Resolved
Comment thread src/apm_cli/core/azure_cli.py Resolved
Comment thread src/apm_cli/deps/download_strategies.py Resolved
Comment thread src/apm_cli/marketplace/client.py Resolved
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

Single-owner ADO auth chain eliminates credential scatter across 12 egress sites, validated by 8 hermetic regression traps and 79 installed-binary lifecycle tests.

panel-mode=lean; personas=auth-expert,supply-chain-security-expert,test-coverage-expert,python-architect,apm-ceo

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

All four panelists converge: the auth chain redesign is structurally sound, credential host-binding is correct, no credential reaches an unintended host, and the architecture guard enforces the single-owner invariant with mutation coverage. The auth-expert and supply-chain-security-expert returned zero findings on a security-critical surface of this scope. The red-team lane's 79 installed-binary lifecycle tests passing on head 96eb98c provides high-confidence evidence that the user-facing auth contract holds end-to-end. The one known residual (marketplace ADO REST following an anonymous 302 before escalating) sends no credential and is queued as a fold after #3785 lands.

The test-coverage-expert surfaced a missing test for the RefResolver exhausted-chain-to-GitLsRemoteError conversion path (ref_resolver.py:544). The chain exhaustion itself is tested; the marketplace-specific catch-and-convert with remediation hints is not. This is a real gap but not a ship-blocker: the worst failure mode is a less helpful error message, not a security regression.

The python-architect's guard-needle hardening recommendation (closing shell-string and f-string evasion of the credential approve/reject prohibition) is a sensible defense-in-depth improvement aligned with the never-approve/reject design decision.

Aligned with: Secure by default (every ADO credential host-bound through one classifier owner; ambient netrc cannot replace it; GCM_INTERACTIVE=0 when unattended); governed by policy (guard transport-platform-auth-outcome-owner with mutation coverage); multi-host (one chain for dev.azure.com, visualstudio.com and Azure DevOps Server; per-org PAT for GitHub policy); pragmatic as npm (any one valid credential source succeeds; the exhausted error names every tried source).

Panel summary

Persona B R N Takeaway
Auth Expert 0 0 0 Auth chain redesign is sound: credential precedence, escalation gating, Basic encoding, helper cache, GCM_INTERACTIVE, and diagnostics are correct with no regressions.
Supply Chain Security Expert 0 0 0 ADO credential host-binding, netrc suppression, helper path derivation, and secret redaction are sound; no credential reaches an unintended host.
Test Coverage Expert 0 1 0 Multi-tier coverage: 8 hermetic regression traps, 4 lifecycle modules with scripted HTTPS proxy, classifier table, guard mutations. One marketplace error-path gap.
Python Architect 0 1 0 Clean ownership split (classifier, ADO walker, entry point); no routed site re-derives auth; cycle-free; under 2100 lines; extensible for approve/reject.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 2 follow-ups

  1. [Test Coverage Expert] Add a test for RefResolver ADO exhausted-chain-to-GitLsRemoteError conversion (ref_resolver.py:544). -- Missing regression trap on a user-facing error contract; a refactor could silently degrade the remediation hint.
  2. [Python Architect] Widen the _CREDENTIAL_STORE_MUTATION guard to also catch unquoted shell-string and f-string forms of credential approve/reject. -- Closes a theoretical evasion path of the never-approve/reject decision; cheap to implement.

Recommendation

Ship. The auth and supply-chain experts returned zero findings on a security-critical 12-site auth refactor, backed by 8 hermetic regression traps and 79 passing lifecycle tests. The two recommended follow-ups are genuine improvements worth folding before merge but do not represent security regressions or user-facing breakage on this commit.


Full per-persona findings

Python Architect

  • [recommended] _CREDENTIAL_STORE_MUTATION guard needle only catches quoted-argv form; shell-string and f-string construction evade it. at scripts/architecture_linter/checks/transport_auth_outcome.py
    The never-approve/reject invariant is security-grade; add an unquoted text pattern to close evasion via shell strings or f-strings.
    Suggested: Add re.compile(r"\bcredential\s+(?:approve|reject)\b") and forbid it across src with the same scan.

Supply Chain Security Expert

No findings.

Auth Expert

No findings.

Test Coverage Expert

  • [recommended] RefResolver ADO exhausted-chain to GitLsRemoteError conversion has no test at any tier. at src/apm_cli/marketplace/ref_resolver.py:544
    marketplace/ref_resolver.py catches AdoAuthChainExhaustedError and converts it to GitLsRemoteError with a remediation hint; no test reaches that path.
    Suggested: Add a test where PAT and az bearer fail and no helper credential exists; assert GitLsRemoteError carries the exhausted summary and hint.
    Proof (missing at): tests/integration/test_ado_ref_resolution_fallback.py -- proves: When marketplace ref resolution exhausts the ADO auth chain, the user sees a helpful error naming every tried credential and remediation steps. [secure-by-default,devx]

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

…ject guard

Fold panel follow-ups on #3790: RefResolver converts an exhausted ADO
chain into GitLsRemoteError naming every step (new integration test), and
transport-platform-auth-outcome-owner also rejects shell-string forms of
git credential approve/reject.

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

- Legacy *.visualstudio.com remotes query the credential helper with the
  Project/_git/repo path the helper stores.
- Tenant id lookup is single-flight under a lock.
- ADO file downloads and marketplace ADO REST fetches no longer follow
  redirects; a sign-in 3xx reaches the classifier and the chain escalates.

apm-spec-waiver: review folds inside the approved auth owner scope

Co-authored-by: Copilot App <[email protected]>
The cause-chain walk follows __cause__/__context__ only through real
exceptions, and any other error value is read as text.

apm-spec-waiver: hardening inside the approved auth classifier owner

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

The ADO items fetch sends only the chain-selected Authorization header,
disables ambient credentials, and refuses the cross-origin sign-in
redirect so the auth chain classifies the 3xx and escalates.

apm-spec-waiver: adapts the approved auth owner to the redirect owner API

Co-authored-by: Copilot App <[email protected]>
…lls; widen resolve fakes

- Add RT1's lock replay (0.35.1 / 0.36.0 locks) and ADO adjacent-egress
  installed-CLI scenarios byte-for-byte.
- Resolver test doubles accept the port/host_type keywords the chain now
  passes.

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

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_now

Delta hardens ADO auth credential scoping: marketplace REST migrated to origin-bounded redirects, Copilot review folds landed, all seven behavior changes test-locked.

panel-mode=delta; personas=auth-expert,supply-chain-security-expert,test-coverage-expert,apm-ceo

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

All three delta-panel specialists agree, with no findings. Material changes since the prior ship_with_followups advisory (head 96eb98c):

  1. The marketplace ADO REST fetch now goes through the origin_bounded_request owner from fix(registry): follow redirects only within the configured registry origin #3785, with ambient_credentials=False and cross-origin follow disabled.
  2. A refused sign-in redirect (RedirectRefusedError) is classified, so the auth chain escalates to the next credential instead of following it.
  3. Copilot review folds: the helper path is fixed for legacy *.visualstudio.com hosts, the az tenant lookup is single-flight, and ADO file downloads no longer follow sign-in redirects.
  4. The classifier never raises on error objects that are not exceptions.
  5. One captain-approved exemption: download_strategies.py is added to fix(registry): follow redirects only within the configured registry origin #3785's frozen redirect inventory. PR 3 will migrate that download.

The prior panel's two follow-ups (RefResolver exhausted-chain test; widened credential approve/reject guard) were folded in d974f7c and are not new work.

Azure DevOps requests use only the credential chosen by the auth chain; ambient credentials and cross-origin redirect following are excluded by construction. Evidence:

  • CI green at 441a6e2.
  • On the merged head: 7546 targeted tests pass, and the RT1 installed-CLI lifecycle cells pass 36/36 with the real binary.
  • The red-team verdict is PASS.

No live Azure DevOps org was available: behavior follows documented contracts and is validated by hermetic tests.

Aligned with: Secure by default (Azure DevOps requests use only the chain-selected credential); multi-harness, multi-host (PAT, az CLI and credential helper paths, including legacy visualstudio.com hosts, route through one chain); governed by policy (the redirect inventory exemption is one bounded, approved entry).

Panel summary

Persona B R N Takeaway
Auth Expert 0 0 0 Delta keeps auth correct: chain-selected credential only via authorization_headers + ambient_credentials=False, sign-in redirect classified and escalated, helper path correct for legacy hosts, tenant cache single-flight sound.
Supply Chain Security Expert 0 0 0 Credential scoping across redirects is tightened; marketplace ADO fetch routes through the origin-bounded owner with ambient exclusion; exemption entry is sound; no residual credential-follow risks in the delta.
Test Coverage Expert 0 0 0 All seven delta behavior changes are locked by mutation-break tests at their surface floor; no silent-drift risk detected.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Recommendation

All three panelists agree, with zero findings, and the prior follow-ups are already folded. The delta tightens credential scoping and adds test coverage; it opens no new risk surface. Merge when CI stays green.


Full per-persona findings

Auth Expert

No findings.

Supply Chain Security Expert

No findings.

Test Coverage Expert

No findings.

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

…n fallback

- Every ADO chain step's git env carries only its own Authorization header,
  suppresses credential helpers, and holds no PAT, bearer, or ambient
  GitHub token from another step (PAT -> bearer -> helper and tokenless).
- A failing AuthResolver never lets the GitHub policy fetch fall back to
  GITHUB_TOKEN, GITHUB_APM_PAT, or GH_TOKEN from the environment.

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

The TestDownloadAdoFile host doubles left auth_resolver.try_with_fallback
as a bare MagicMock, so download_ado_file returned a mock instead of
exercising 404 fallback, auth exhaustion, and network errors. They now
install the simulated chain the unit twin uses, which runs the real
AuthResolver chain against the mocked transport.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 155a2d7 into main Nov 18, 2026
30 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-0361-t1-pr1-auth-owner branch November 18, 2026 02:49
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
…ted-egress-guard

#3790's squash differs from the previously merged head 74ef67d only in
three test files; those deltas are applied here.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
)

* fix(uninstall): route every deploy through one effective-selection owner (#3760)

apm uninstall re-integrated surviving packages without their skills:
selection, so every skill of a surviving bundle was redeployed and left
unrecorded in the lockfile. Add effective_dependency_selection() in
install/package_resolution.py as the single owner of the effective deploy
selection and route install preflight, install deploy, audit replay and
uninstall re-integration through it. skill_subset is now a required
keyword of integrate_package_primitives and prepare_package_deployment.

apm-spec-waiver: deploy-time skill selection routing fix; no OpenAPM spec requirement covers uninstall re-integration selection

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

* fix(install): guard the effective deploy-selection owner (#3760)

Add the install-deployment-effective-selection architecture guard: every
integrate_package_primitives, prepare_package_deployment and
DeployableSourcePlan.create call passes skill_subset (and any
dep_target_subset) from effective_dependency_selection, with allowlisted
hooks-only and plan-derived sites, and skill_subset stays a required
keyword. Register the dependency-selection owner, add its MutationCase and
mutation-break cases, update the audit-replay guard and its tests to the
owner call, pass skill_subset explicitly in direct test callers, add a
TypeError unit test and the uninstall L7 lifecycle test (project and -g),
and document the uninstall rebuild selection.

apm-spec-waiver: deploy-time skill selection routing fix; no OpenAPM spec requirement covers uninstall re-integration selection

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

* docs(changelog): uninstall keeps skills: selection (#3784)

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

* test: pass skill_subset in spec conformance callers; register effective-selection rule (#3760)

apm-spec-waiver: test-only call-site update for the required skill_subset argument; no spec behavior change

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

* fix(install): route lockfile record and target resolution via owner

Panel follow-ups on #3784. The lockfile builder recorded the skill subset
by calling effective_deploy_skill_subset itself, and uninstall hook
reconcile plus the explicit-target preflight read dep_ref.target_subset
directly, so the owner covered less than its registry entry claimed.
All three now take the selection from effective_dependency_selection.

The install-deployment-effective-selection guard now also checks every
resolve_effective_package_targets call, keeps effective_deploy_skill_subset
internal to the owner module, and resolves aliased imports of the deploy
functions; four new bypass mutations prove each case.

The #3760 lifecycle test is now lifecycle_smoke (runs in the PR-time
lifecycle job) and gains a survivor targets: narrowing case.

apm-spec-waiver: install deploy-selection routing with no OpenAPM requirement change

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

* test(install): lockfile records the owner's deployed selection (#3784)

Traps the lockfile builder's route through effective_dependency_selection:
it records the persisted plus CLI --skill union for skill bundles only.

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

* test(skills): make the U1 x legacy layout assert unconditional (#3784)

#3793 guarded the post-uninstall legacy-root assertion with an xfail
until #3760 landed. With the effective-selection owner in place the
survivor keeps only its selected skill, so the conditional would only
mask a future U1 regression.

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

* test(uninstall): PR-time U1 trap for the legacy skill layout (#3784)

The U1 x --legacy-skill-paths assertion in the #3793 lifecycle module
only runs in the merge queue. Add a cheap local-path case to the
lifecycle_smoke module so a survivor-selection regression on the legacy
layout fails on every PR. Fails on pre-fix src (all 4 skills
re-integrated), passes at head.

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

* Merge main (dfb6a83) into #3784; slot CHANGELOG bullet

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

* test: follow #3790 rename in the preflight target mutation anchor (#3784)

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

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
#3735) (#3786)

* fix(uninstall): route every deploy through one effective-selection owner (#3760)

apm uninstall re-integrated surviving packages without their skills:
selection, so every skill of a surviving bundle was redeployed and left
unrecorded in the lockfile. Add effective_dependency_selection() in
install/package_resolution.py as the single owner of the effective deploy
selection and route install preflight, install deploy, audit replay and
uninstall re-integration through it. skill_subset is now a required
keyword of integrate_package_primitives and prepare_package_deployment.

apm-spec-waiver: deploy-time skill selection routing fix; no OpenAPM spec requirement covers uninstall re-integration selection

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

* fix(install): guard the effective deploy-selection owner (#3760)

Add the install-deployment-effective-selection architecture guard: every
integrate_package_primitives, prepare_package_deployment and
DeployableSourcePlan.create call passes skill_subset (and any
dep_target_subset) from effective_dependency_selection, with allowlisted
hooks-only and plan-derived sites, and skill_subset stays a required
keyword. Register the dependency-selection owner, add its MutationCase and
mutation-break cases, update the audit-replay guard and its tests to the
owner call, pass skill_subset explicitly in direct test callers, add a
TypeError unit test and the uninstall L7 lifecycle test (project and -g),
and document the uninstall rebuild selection.

apm-spec-waiver: deploy-time skill selection routing fix; no OpenAPM spec requirement covers uninstall re-integration selection

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

* docs(changelog): uninstall keeps skills: selection (#3784)

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

* fix(deps): merge diamond skill and target selections through one owner (#3735)

WIP: selection-merge owner, resolver edge accumulator, uninstall shrink,
audit via the owner, frozen selection reason, static guard.

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

* test(deps): real-binary diamond selection lifecycle (#3735)

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

* test(deps): fold RT4 selection-merge lifecycle suite; deterministic parent ties; docs (#3735)

resolved_by ties among equal-depth parents break by lowest parent key, so
manifest order no longer changes apm.lock.yaml bytes.

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

* docs(changelog): selection merge entry (#3786)

apm-spec-waiver: lockfile skill_subset/target_subset meaning clarified in lockfile-spec.md only; the normative requirement is deferred to #3763 per approved decision D7.

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

* test(audit): declared-selection wording in subset replay lifecycle (#3786)

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

* fix(deps): keep download annotations on merged references; trim resolve phase (#3786)

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

* test(deps): trap audit target_subset, marketplace keys and dev edges (#3786)

Addresses panel follow-ups FU1-FU3 (test-coverage-expert): the audit
target_subset mismatch branch, the marketplace declaration mapping in
declared_node_selections, and a devDependencies edge contributing its
selection, each proven by a mutation that breaks it.

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

* test: pass skill_subset in spec conformance callers; register effective-selection rule (#3760)

apm-spec-waiver: test-only call-site update for the required skill_subset argument; no spec behavior change

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

* fix(install): route lockfile record and target resolution via owner

Panel follow-ups on #3784. The lockfile builder recorded the skill subset
by calling effective_deploy_skill_subset itself, and uninstall hook
reconcile plus the explicit-target preflight read dep_ref.target_subset
directly, so the owner covered less than its registry entry claimed.
All three now take the selection from effective_dependency_selection.

The install-deployment-effective-selection guard now also checks every
resolve_effective_package_targets call, keeps effective_deploy_skill_subset
internal to the owner module, and resolves aliased imports of the deploy
functions; four new bypass mutations prove each case.

The #3760 lifecycle test is now lifecycle_smoke (runs in the PR-time
lifecycle job) and gains a survivor targets: narrowing case.

apm-spec-waiver: install deploy-selection routing with no OpenAPM requirement change

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

* test(install): lockfile records the owner's deployed selection (#3784)

Traps the lockfile builder's route through effective_dependency_selection:
it records the persisted plus CLI --skill union for skill bundles only.

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

* fix(deps): merge replaced, aliased and marketplace diamonds; audit fails closed (#3786)

Addresses the four Copilot inline findings:
- replace: diamonds now lock and reload the merged selection (the binding
  original carries the union; lock evidence re-merges every request);
- audit treats an incomplete declaration walk as unverified unless an
  unrestricted edge absorbs the unread declarations;
- the reachability walk reads an aliased node where the lock materialized it;
- marketplace declarations map to their locked entry at every depth.
Each fold is proven by a mutation that breaks its new test.

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

* fix(deps): expand same-repo path children of fetched packages in the walk (#3786)

The declared-selection walk loaded package manifests without their origin,
so a fetched package's same-repository path: child stayed a consumer-local
path, never reached its locked node, and audit reported it unverified
(test_mcp_dev_dependency_lifecycle). Mark the origin as install and
DeclaredTransportIndex do.

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

* test(skills): make the U1 x legacy layout assert unconditional (#3784)

#3793 guarded the post-uninstall legacy-root assertion with an xfail
until #3760 landed. With the effective-selection owner in place the
survivor keeps only its selected skill, so the conditional would only
mask a future U1 regression.

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

* test(uninstall): PR-time U1 trap for the legacy skill layout (#3784)

The U1 x --legacy-skill-paths assertion in the #3793 lifecycle module
only runs in the merge queue. Add a cheap local-path case to the
lifecycle_smoke module so a survivor-selection regression on the legacy
layout fails on every PR. Fails on pre-fix src (all 4 skills
re-integrated), passes at head.

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

* test(deps): replaced diamond locks and audits its union end to end (#3786)

Addresses delta panel follow-ups: an integration trap installs a replace:
diamond whose parents select different skills and audits the locked union;
the unit trap now round-trips the lock; the resolver keeps an explicitly
empty merged selection as the replacement path does.

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

* Merge main (dfb6a83) into #3784; slot CHANGELOG bullet

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

* test: follow #3790 rename in the preflight target mutation anchor (#3784)

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

* docs(changelog): drop duplicate #3784 bullet after main merge (#3786)

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

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: azevedo-luis <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
…3823)

* fix(auth): route every Azure DevOps egress through one auth chain owner

AuthResolver.try_with_fallback is now the single entry for authenticated
host access. A new core/auth_outcome.py owns auth-outcome classification
(401/403, a redirect to the ADO sign-in service, an HTML sign-in page, Git
auth errors) and core/auth_chain.py walks ADO_APM_PAT -> az bearer ->
path-scoped git credential fill, recording an AuthAttemptLog that
diagnostics render.

- Route install validation, clone, ref resolution, install --update
  preflight, ADO file downloads, org policy discovery (ADO, GitHub with
  per-org PAT, GitLab) and marketplace REST/ref paths through the chain.
- Helper credentials keep their username (GitHelperCredential) and are
  sent as Basic username:password, cached per (host, port, path).
- git credential fill sets GCM_INTERACTIVE=0 when stdin is not a TTY or
  CI is set; APM never calls credential approve/reject.
- Azure DevOps requests use only the credential chosen by the auth chain.
- #3753: az token failures show the Azure CLI reason; the exhausted chain
  lists every step in order; "bearer token" is no longer redacted.
- Remove execute_with_bearer_fallback; is_ado_auth_failure_signal and
  is_public_github_auth_failure become thin classifier wrappers.
- Static guard transport-platform-auth-outcome-owner on the
  host-credential-resolution owner record, with a mutation case.

No live Azure DevOps organization was available: behavior follows the
documented contracts and is validated by hermetic tests.

Fixes #3752
Fixes #3758
Fixes #3753

apm-spec-waiver: auth chain owner refactor with no spec surface change

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

* docs(changelog): reference #3790 for the ADO auth chain fixes

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

* test(auth): cover marketplace exhausted-chain error; widen approve/reject guard

Fold panel follow-ups on #3790: RefResolver converts an exhausted ADO
chain into GitLsRemoteError naming every step (new integration test), and
transport-platform-auth-outcome-owner also rejects shell-string forms of
git credential approve/reject.

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

* fix(auth): fold Copilot review on ADO helper path, tenant cache, sign-in redirects

- Legacy *.visualstudio.com remotes query the credential helper with the
  Project/_git/repo path the helper stores.
- Tenant id lookup is single-flight under a lock.
- ADO file downloads and marketplace ADO REST fetches no longer follow
  redirects; a sign-in 3xx reaches the classifier and the chain escalates.

apm-spec-waiver: review folds inside the approved auth owner scope

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

* chore(lock): refresh auth skill deployed hash

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

* test(auth): route remaining preflight and bare-clone tests through the chain

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

* fix(auth): classification never raises on non-exception error objects

The cause-chain walk follows __cause__/__context__ only through real
exceptions, and any other error value is read as text.

apm-spec-waiver: hardening inside the approved auth classifier owner

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

* arch: add authenticated-egress ownership guard

Add transport-platform-authenticated-egress, an AST architecture-linter
rule that keeps HTTP egress primitives (requests verbs and sessions,
urllib urlopen) and literal credential header keys in their owner
modules or in a frozen, reasoned inventory that can only shrink.

The rule carries two guard ids registered on host-credential-resolution
and credential-origin-scope. lint-auth-signals.sh drops stale Rule A
exemptions and Rule B now defers to the architecture linter.

Refs #3752, #3726

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

* fix(marketplace): ADO REST fetch sends the chain credential through the redirect owner

The ADO items fetch sends only the chain-selected Authorization header,
disables ambient credentials, and refuses the cross-origin sign-in
redirect so the auth chain classifies the 3xx and escalates.

apm-spec-waiver: adapts the approved auth owner to the redirect owner API

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

* test(auth): carry RT1 upgrade-replay and adjacent-egress lifecycle cells; widen resolve fakes

- Add RT1's lock replay (0.35.1 / 0.36.0 locks) and ADO adjacent-egress
  installed-CLI scenarios byte-for-byte.
- Resolver test doubles accept the port/host_type keywords the chain now
  passes.

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

* test(policy): drop T2 xfail now that canonical targets (#3774) are on main

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

* test(auth): re-lock per-step credential isolation and policy env-token fallback

- Every ADO chain step's git env carries only its own Authorization header,
  suppresses credential helpers, and holds no PAT, bearer, or ambient
  GitHub token from another step (PAT -> bearer -> helper and tokenless).
- A failing AuthResolver never lets the GitHub policy fetch fall back to
  GITHUB_TOKEN, GITHUB_APM_PAT, or GH_TOKEN from the environment.

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

* test(auth): assert the narrow exhausted-chain exception

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

* arch: route remaining credential egress through the owners

Policy fetches (URL, GitHub, Azure DevOps, GitLab), the Artifactory
boundary probe and the install validation GitHub probe now send through
origin_bounded_request. Policy and probe redirects away from the
requested resource stay unfollowed and are reported as before.
Literal credential headers move to AuthResolver.github_rest_headers,
AuthResolver.bearer_headers and RegistryAuthContext.headers.

The authenticated-egress inventory drops every pending entry; the
origin-bounded-redirect inventory drops the policy and Artifactory
entries; lint-auth-signals Rule B also defers auth-outcome-owner.

Refs #3752, #3726

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

* fix(marketplace): drop final-URL HTTPS recheck owned by origin_bounded_request

The origin-bounded owner sends every hop without automatic redirects and
refuses HTTPS downgrades, so the response URL check in _fetch_url_direct
could never fire. The test now drives a downgrade redirect through the
owner instead of faking a final URL.

Refs #3726

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

* arch(auth): route the ADO file download through the redirect owner

DownloadDelegate.resilient_get takes redirect_base instead of
allow_redirects; when set, every retry attempt goes through
origin_bounded_request bounded to that base, with ambient netrc
excluded. download_ado_file passes its request URL, so no redirect is
followed and a sign-in 3xx still reaches the auth-outcome classifier.
The 429/503/connection retry and backoff loop is unchanged.

A shared owner helper, unfollowed_redirect_request, returns the
refused 3xx instead of raising; policy fetches and the Artifactory
boundary probe use it too. The download_strategies entry leaves the
origin-bounded-redirect inventory.

apm-spec-waiver: redirect routing inside the approved auth and redirect owners

Refs #3752, #3726

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

* test(install): retarget the GitHub probe integration double to the owner seam

Refs #3752

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

* test(arch): pin the urllib metadata vector in the egress mutation case

The authenticated-egress owner case now reintroduces urllib.request.urlopen
in the marketplace metadata fetch; direct requests.get egress stays covered
by the rule's unit tests.

Refs #3726

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

* fix(auth): fold review panel findings on the egress guard

- unfollowed_redirect_request now follows no redirect (max_hops=0), so a
  same-path 3xx is returned like any other; pinned with a real-socket
  test plus Artifactory and ADO download retry cases.
- The validation GitHub probe treats a refused redirect as inconclusive
  and leaves the decision to the download step, with a verbose reason.
- The egress guard reads its credential header vocabulary from
  CREDENTIAL_HEADER_NAMES (adds Proxy-Authorization) and pins an exact
  site count per inventory entry; the resilient_get reason now states
  what the code does.
- deps/registry/auth.py header ownership narrows to RegistryAuthContext;
  owner records name the new helpers and consumers.
- Tests assert the probe's token header and the REST header builders.

apm-spec-waiver: review folds inside the approved auth and redirect owners

Refs #3752, #3726

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

* fix(policy): keep URL credentials on direct policy fetches; widen egress prefilter

- policy_get moves userinfo from a direct policy URL into an explicit Basic
  header through the new http_credentials.split_url_credentials owner
  helper, matching the previous requests behaviour. Redirect targets that
  embed userinfo stay refused. Covered by a transport-level test that only
  mocks the adapter send.
- The egress guard prefilter also matches 'session', so session-receiver
  calls in modules without other HTTP tokens are scanned.
- The no-follow regression test covers query and descendant-path shapes.

apm-spec-waiver: review folds inside the approved auth and redirect owners

Refs #3726

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

* test(install): make the Artifactory same-path redirect trap probe a real candidate

Refs #3726

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

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
Reverts the previous wording change at @danielmeppiel's direction: #3752, #3753 and #3758 are closed by #3790.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
The GitLab routing tests clear os.environ, but since #3790 the REST fallback reads git config through get_git_executable(). On Windows, with PATH cleared, git cannot be found unless an earlier test on the same xdist worker already cached it, so the tests fail depending on test order (build-release run 44233799606 on e217a53). Keep PATH, SYSTEMROOT and PATHEXT in the cleared env, and mark the module windows_compat so the PR-time Windows gate runs it.

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
* chore: release v0.36.1

Bump apm-cli to 0.36.1 in pyproject.toml and the apm-cli entry of uv.lock (no uv lock re-resolve), and cut the [Unreleased] CHANGELOG block into [0.36.1] - 2026-11-18 with upgrade notes. The #3771 and #3776 notes move into [0.36.0], where they shipped. Lint mirror (ruff check, ruff format --check, pylint R0801, auth-signals) is clean on main 70554b6.

Post-merge: run the pre-tag gate on the merge commit, then tag v0.36.1.

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

* docs(changelog): do not claim ADO issues fixed before a live-org check

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

* docs(changelog): close the Azure DevOps issues in the 0.36.1 entry

Reverts the previous wording change at @danielmeppiel's direction: #3752, #3753 and #3758 are closed by #3790.

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

* docs(changelog): note SSE removals and the COPILOT_HOME skill scope in 0.36.1 upgrade notes

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

* docs(changelog): drop the 0.36.1 upgrade-notes paragraph

Patch releases carry upgrade details in their entries, as before.

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

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[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

2 participants