Fix SC2046 shellcheck errors: Quote command substitutions to prevent word splitting#566
Merged
thpierce merged 5 commits intoaws-observability:mainfrom Feb 17, 2026
Conversation
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 SC2046 shellcheck errors by adding quotes around command substitutions to prevent word splitting. SC2046 has been removed from the actionlint ignore list in
.github/workflows/pr-build.yml.Changes Made
Files Modified (5 workflow files + 1 config file)
1.
.github/workflows/pr-build.yml(lines 79, 90)2.
.github/workflows/dotnet-lambda-test.yml(line 143)3.
.github/workflows/java-lambda-test.yml(line 145)4.
.github/workflows/node-lambda-test.yml(line 147)5.
.github/workflows/python-lambda-test.yml(line 163)6.
.github/workflows/python-ec2-genesis-test.yml(line 72)Why This Change is Safe
Lambda Tests (dotnet, java, node, python)
API_GATEWAY_URL=$(terraform output -raw api-gateway-url)API_GATEWAY_URL="$(terraform output -raw api-gateway-url)"Python EC2 Genesis Test
ID_1="$(printf '%08x' $(date +%s))"ID_1="$(printf '%08x' "$(date +%s)")"Testing
Actionlint Validation
actionlint -color -ignore SC2086 -ignore SC2004 -ignore SC2129 -ignore SC2016 -ignore SC2010 -ignore SC2015 -ignore SC2260 -ignore SC2181 .github/workflows/*.ymlExit code: 0 ✅
Behavioral Testing
Test 1: API Gateway URL Assignment
Test 2: Timestamp Formatting
What SC2046 Prevents
SC2046 warns about unquoted command substitutions because they undergo word splitting. If a command's output contains spaces, tabs, or newlines, the shell will split it into multiple words. This can lead to:
In this codebase:
Impact Assessment
Type: Code quality improvement
This is not a bug fix but a best practice improvement. The commands being quoted (
terraform outputanddate +%s) produce predictable output without spaces, so the unquoted versions work correctly. However, quoting command substitutions is a shell scripting best practice that:Verification Checklist