{Resource} Fix CredScan sanitize hardcoded storage account key in test recording#33656
Open
YangAn-microsoft wants to merge 1 commit into
Open
{Resource} Fix CredScan sanitize hardcoded storage account key in test recording#33656YangAn-microsoft wants to merge 1 commit into
YangAn-microsoft wants to merge 1 commit into
Conversation
…_policy recording to fix CredScan (CSCAN-AZURE0070)
️✔️AzureCLI-FullTest
|
|
Hi @YangAn-microsoft, |
️✔️AzureCLI-BreakingChangeTest
|
Contributor
There was a problem hiding this comment.
Pull request overview
Updates an Azure CLI Resource command module test recording to remove a literal storage account key that triggered CredScan, aligning the cassette content with the testsdk’s standard storage key replacement value.
Changes:
- Replaced a hardcoded
storageAccountKeyvalue embedded in a policy definition recording withveryFakedStorageAccountKey==. - Ensured the replacement matches the testsdk’s
StorageAccountKeyReplacer.KEY_REPLACEMENTvalue.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
Resource |
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.
The
test_resource_show_built_in_policycassette (src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_show_built_in_policy.yaml) contained a literal storage account key embedded in a policy definition'sprotectedSettings. This tripped Guardian CredScan rule CSCAN-AZURE0070 and caused a build break.The hardcoded key was replaced with the standard fake value
veryFakedStorageAccountKey==(matchingStorageAccountKeyReplacer.KEY_REPLACEMENT). The test still passes in playback since that field is not asserted.No HISTORY.rst entry — this is an internal, test-only change with no customer-facing impact.