fix: remove hardcoded VM password, secure credential docs, and eliminate eval in quota script#136
Closed
Rafi-Microsoft wants to merge 2 commits intomicrosoft:devfrom
Closed
Conversation
- Remove hardcoded default password from vmAdminPassword parameter in main.bicepparam to prevent known credentials from being deployed unintentionally. The parameter now defaults to an empty string, requiring users to set VM_ADMIN_PASSWORD via azd env set. - Update deployment guide to remove guidance that encouraged committing VM credentials to source control. Replaced with security warning recommending azd env set, secrets manager, or pipeline secret variables. - Aligned with VM credential patterns used by other Microsoft solution accelerators (Content Generation, Code Modernization, DKM, Container Migration) which use pure environment variable substitution with no hardcoded password defaults. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace unsafe eval-based dynamic variable names with a declare -A associative array keyed by 'region:index'. This eliminates potential code-injection risks from eval and improves script maintainability. Addresses Copilot review comments on PR microsoft#131 (lines 191, 216, 226, 294 of scripts/quota_check.sh). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4 tasks
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.
Purpose
Addresses security and code quality concerns identified by GitHub Copilot code reviews on PR #131. This PR makes three targeted fixes:
Remove hardcoded VM password default (
infra/main.bicepparam): ThevmAdminPasswordparameter previously usedreadEnvironmentVariable('VM_ADMIN_PASSWORD', 'JumpboxAdminP@ssw0rd1234!')- a known credential deployed by default. Changed the fallback to an empty string so deployment requires explicit credential configuration viaazd env set.Update deployment guide security guidance (
docs/deploymentguide.md): Removed documentation that encouraged committing VM passwords to source control viamain.bicepparam. Replaced with a security warning recommendingazd env set, secrets managers, or pipeline secret variables.Replace unsafe eval with associative array (
scripts/quota_check.sh): Replacedeval-based dynamic variable names with adeclare -Aassociative array keyed byregion:index. This eliminates potential code-injection risks and improves script maintainability. Tested and verified the script runs correctly with the new approach.Cross-repo alignment: All other Microsoft solution accelerators (Content Generation, Code Modernization, DKM, Container Migration, RTI, BYOCC, etc.) use pure environment variable substitution with no hardcoded password defaults for VM credentials. This fix aligns Deploy-Your-AI-Application-In-Production with that established security pattern.
Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid:
azd env set VM_ADMIN_PASSWORD "<strong-password>"followed byazd updeploys the Jump VM successfullyVM_ADMIN_PASSWORDprompts or fails gracefully (no hardcoded password deployed)docs/deploymentguide.mdrenders correctly with the security warning./scripts/quota_check.sh --regions eastus,westus --verboseruns correctly and displays quota summary tableOther Information
main.bicepparam(line 208)deploymentguide.md(line 219)evalusage inquota_check.sh(lines 191, 216, 226, 294)