Fix SC2086 shellcheck errors: quote variables to prevent globbing and word splitting#571
Merged
Fix SC2086 shellcheck errors: quote variables to prevent globbing and word splitting#571
Conversation
… word splitting - Quote $GITHUB_OUTPUT and $GITHUB_ENV in all echo redirects - Quote $GITHUB_PATH in echo redirects - Quote variables in AWS CLI commands (instance IDs, secret names, etc.) - Quote variables in kubectl commands - Quote variables in docker commands - Quote variables in file operations (zip, mkdir, etc.) - Quote variables in command substitutions and pipes All changes preserve existing functionality while improving shell script safety by preventing unintended word splitting and glob expansion.
2d3d4dd to
7b074eb
Compare
majanjua-amzn
approved these changes
Feb 17, 2026
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.
Summary
This PR fixes all SC2086 shellcheck errors by properly quoting shell variables to prevent unintended word splitting and glob expansion.
Changes Made
Files Modified (45 workflow files)
All changes involve adding double quotes around variables in shell scripts within GitHub Actions workflows.
Key Patterns Fixed
GitHub Actions Variables (most common):
>> $GITHUB_OUTPUT→>> "$GITHUB_OUTPUT">> $GITHUB_ENV→>> "$GITHUB_ENV">> $GITHUB_PATH→>> "$GITHUB_PATH"AWS CLI Commands:
--instance-ids $instance_id→--instance-ids "$instance_id"--secret-id $SECRET_NAME→--secret-id "$SECRET_NAME"Values=$instance_id→Values="$instance_id"Kubernetes Commands:
kubectl delete namespace $ns→kubectl delete namespace "$ns"kubectl get pods -n $ns→kubectl get pods -n "$ns"Docker Commands:
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG→docker build -t "$REGISTRY/$REPOSITORY:$IMAGE_TAG"File Operations:
zip -r file-${VERSION}.zip→zip -r file-"${VERSION}".zipmkdir -p $ARTIFACTS_DIR→mkdir -p "$ARTIFACTS_DIR"Function Calls:
watch_command $command_id→watch_command "$command_id"check_instance_ready ${{...}}→check_instance_ready "${{...}}"Command Substitutions:
echo $DIRS | jq→echo "$DIRS" | jqtee --append $GITHUB_ENV→tee --append "$GITHUB_ENV"Why This Change Is Safe
Code Quality Improvement
SC2086 warnings indicate potential bugs where:
Behavioral Equivalence
All fixes maintain identical behavior because:
No Functional Changes
Testing
Validation Command
actionlint -color -ignore SC2004 -ignore SC2129 -ignore SC2016 -ignore SC2010 -ignore SC2015 -ignore SC2260 -ignore SC2046 -ignore SC2181 .github/workflows/*.ymlResult
✅ Exit code: 0 - All SC2086 errors resolved
Test Scenarios
The changes were validated to ensure:
Impact Assessment
Type: Code Quality Improvement
This is a code quality fix, not a bug fix. The code worked before because:
Benefits
Removed from Ignore List
# SC2086: Double quote to prevent globbing and word splitting (212 occurrences)-ignore SC2086Files Changed
45 workflow files across all test suites (Java, Python, Node, .NET, K8s, ECS, EKS, Lambda, EC2, etc.)
Next Steps
After this PR merges, the team can continue systematically removing other shellcheck suppressions from the ignore list.