fix(azure): pass authority to credentials for sovereign clouds#10284
Open
Br1an67 wants to merge 1 commit intoprowler-cloud:masterfrom
Open
fix(azure): pass authority to credentials for sovereign clouds#10284Br1an67 wants to merge 1 commit intoprowler-cloud:masterfrom
Br1an67 wants to merge 1 commit intoprowler-cloud:masterfrom
Conversation
The ClientSecretCredential and InteractiveBrowserCredential were missing the authority parameter needed for sovereign cloud authentication (e.g. AzureChinaCloud, AzureUSGovernment). This caused token retrieval to fail when using --sp-env-auth or --browser-auth with non-default clouds. The DefaultAzureCredential already included this parameter, so this aligns the behavior across all authentication methods.
Contributor
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
Member
|
Hi @Br1an67 thanks for this one! Could you please add some evidences for us to validate this fixes the bug? We don't have access to an Azure subscription in China, so we can't validate it. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10284 +/- ##
===========================================
+ Coverage 56.85% 86.06% +29.21%
===========================================
Files 87 222 +135
Lines 2846 5720 +2874
===========================================
+ Hits 1618 4923 +3305
+ Misses 1228 797 -431
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
b06e4b3 to
a78df7a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8425
Context
When using Prowler to scan Azure sovereign clouds (AzureChinaCloud, AzureUSGovernment) with service principal authentication (
--sp-env-auth) or browser authentication (--browser-auth), the token retrieval fails because the credentials are created without specifying the correct authority endpoint for the cloud environment.Description
The
ClientSecretCredentialandInteractiveBrowserCredentialclasses were missing theauthorityparameter needed for sovereign cloud authentication. This caused authentication requests to go to the default public cloud authority (https://login.microsoftonline.com) instead of the correct sovereign cloud authority (e.g.,https://login.chinacloudapi.cnfor AzureChinaCloud).The fix adds the
authority=region_config.authorityparameter to both credential types, aligning their behavior withDefaultAzureCredentialwhich already included this parameter.Changes:
authority=region_config.authoritytoClientSecretCredentialinsetup_session()authority=region_config.authoritytoInteractiveBrowserCredentialinsetup_session()Files changed:
Steps to review
prowler/providers/azure/azure_provider.pyauthorityparameter is now passed to bothClientSecretCredentialandInteractiveBrowserCredentialDefaultAzureCredentialLicense
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.