Skip to content

[Key Vault] Remove stale no-op insecure_domain_change pop for parity with azure-core #45518#47320

Open
RadikHoroshev wants to merge 1 commit into
Azure:mainfrom
RadikHoroshev:keyvault/remove-stale-insecure-domain-change-pop
Open

[Key Vault] Remove stale no-op insecure_domain_change pop for parity with azure-core #45518#47320
RadikHoroshev wants to merge 1 commit into
Azure:mainfrom
RadikHoroshev:keyvault/remove-stale-insecure-domain-change-pop

Conversation

@RadikHoroshev
Copy link
Copy Markdown

Description

#45518 fixed the cross-domain redirect Authorization-header strip in azure-core by persisting the insecure_domain_change flag on request.context (a Dict subclass) instead of the ephemeral request.context.options kwargs dict. As part of that fix it removed the now-obsolete line from azure-core's BearerTokenCredentialPolicy:

request.context.options.pop("insecure_domain_change", False)

The Key Vault packages each carry an independent forked copy of the challenge-authentication policy (challenge_auth_policy.py + its async variant under _shared/ or _internal/) that still contained that exact line. Because the live flag now lives on request.context and .options is the stale kwargs dict, the pop is a no-op. This PR removes it (sync + async) for parity with the azure-core fix.

This mirrors azure-core exactly: the surrounding block now goes straight from if request_authorized: to the try: that re-sends the request, identical to _authentication.py after #45518.

No functional change — the removed line had no effect once the flag moved off request.context.options.

Files (5 packages, sync + async = 10)

  • azure-keyvault-keys_shared/challenge_auth_policy.py, _shared/async_challenge_auth_policy.py
  • azure-keyvault-secrets — same pair under _shared/
  • azure-keyvault-certificates — same pair under _shared/
  • azure-keyvault-administration — same pair under _internal/
  • azure-keyvault-securitydomain — same pair under _internal/

CHANGELOG

Added an Other Changes note to the four packages with an open (Unreleased) section (administration, certificates, keys, securitydomain). azure-keyvault-secrets currently has no open unreleased version (top entry is the released 4.11.0), so no changelog entry was added there to avoid an unwarranted version bump for an internal no-op — happy to add one if maintainers prefer.

All SDK Contribution checklist:

  • The pull request does not introduce breaking changes
  • CHANGELOG is updated for the four packages with an open unreleased version (see note above re: secrets).
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • A single, informatively-messaged commit.

Testing Guidelines

  • Pull request includes test coverage for the included changes. — N/A: dead-code removal with no behavioral change; the existing challenge-authentication tests continue to exercise the policy.

🤖 Generated with Claude Code

…with azure-core Azure#45518

PR Azure#45518 fixed the cross-domain redirect Authorization-header strip in azure-core by persisting the insecure_domain_change flag on request.context instead of the ephemeral request.context.options kwargs dict, and removed the now-obsolete request.context.options.pop("insecure_domain_change", False) line from azure-core's BearerTokenCredentialPolicy.

The Key Vault packages carry independent forked copies of the challenge authentication policy that still contained that exact line. Since the flag now lives on request.context and .options is the stale kwargs dict, the pop is a no-op. This removes it (sync + async) across azure-keyvault-keys, -secrets, -certificates, -administration and -securitydomain for parity with the azure-core fix. No functional change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 3, 2026 16:59
@RadikHoroshev RadikHoroshev requested a review from a team as a code owner June 3, 2026 16:59
@github-actions github-actions Bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. KeyVault labels Jun 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

Thank you for your contribution @RadikHoroshev! We will review the pull request and get back to you soon.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Removes a previously redundant context-option mutation from Key Vault challenge authentication policies to match an azure-core change, and records the cleanup in select package changelogs.

Changes:

  • Removed request.context.options.pop("insecure_domain_change", False) from sync/async challenge auth policies across multiple Key Vault packages.
  • Added changelog notes in securitydomain, keys, certificates, and administration packages referencing azure-core PR #45518.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/keyvault/azure-keyvault-securitydomain/azure/keyvault/securitydomain/_internal/challenge_auth_policy.py Removes option-pop line in sync challenge flow
sdk/keyvault/azure-keyvault-securitydomain/azure/keyvault/securitydomain/_internal/async_challenge_auth_policy.py Removes option-pop line in async challenge flow
sdk/keyvault/azure-keyvault-securitydomain/CHANGELOG.md Documents the internal cleanup / parity note
sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/challenge_auth_policy.py Removes option-pop line in sync challenge flow
sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/async_challenge_auth_policy.py Removes option-pop line in async challenge flow
sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/challenge_auth_policy.py Removes option-pop line in sync challenge flow
sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/async_challenge_auth_policy.py Removes option-pop line in async challenge flow
sdk/keyvault/azure-keyvault-keys/CHANGELOG.md Documents the internal cleanup / parity note
sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_shared/challenge_auth_policy.py Removes option-pop line in sync challenge flow
sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_shared/async_challenge_auth_policy.py Removes option-pop line in async challenge flow
sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md Documents the internal cleanup / parity note
sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_internal/challenge_auth_policy.py Removes option-pop line in sync challenge flow
sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_internal/async_challenge_auth_policy.py Removes option-pop line in async challenge flow
sdk/keyvault/azure-keyvault-administration/CHANGELOG.md Documents the internal cleanup / parity note


### Other Changes

- Removed a stale, no-op line from the internal challenge authentication policy for parity with the `azure-core` fix in [#45518](https://github.com/Azure/azure-sdk-for-python/pull/45518). This is an internal cleanup with no functional impact.
Comment on lines 148 to 153

request_authorized = self.on_challenge(request, response)
if request_authorized:
# if we receive a challenge response, we retrieve a new token
# which matches the new target. In this case, we don't want to remove
# token from the request so clear the 'insecure_domain_change' tag
request.context.options.pop("insecure_domain_change", False)
try:
response = self.next.send(request)
except Exception: # pylint:disable=broad-except
@RadikHoroshev
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. KeyVault

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants