fix(ci): prevent script injection in trigger-codepipeline workflow (#1111)
Summary
Fixes an ACAT/AppSec script injection finding in
.github/workflows/trigger-codepipeline.yml(lines 24-26). Thegithub.event.head_commit.author.namecontext value was interpolated directly via${{ }}into the inlinerun:script.A commit author name is user-controlled — an attacker can craft a commit whose author name contains shell metacharacters (e.g.
$(...)or"; ...; "). When that commit lands onmain, the workflow runs the injected command. This job hasid-token: writeand assumesGitHubActionsCodePipelineRole, so injected commands would execute with AWS credentials able to start CodePipeline.Fix
Per GitHub Actions security-hardening guidance, the value is now bound to a step-level
env:variable and referenced as a quoted shell variable ($COMMIT_AUTHOR). Environment values are passed to the shell as data rather than expanded into script text, which removes the injection vector. No behavior change for legitimate commits.- name: Trigger CodePipeline for Maven/NuGet + env: + COMMIT_AUTHOR: ${{ github.event.head_commit.author.name }} run: | - echo "Triggering CodePipeline for user commit by ${{ github.event.head_commit.author.name }}" + echo "Triggering CodePipeline for user commit by $COMMIT_AUTHOR" aws codepipeline start-pipeline-execution --name PackagePipelineNote: the
if:condition on the job also referenceshead_commit.author.name, but that is a GitHub Actions expression (evaluated by the expression engine, not the shell), so it is not an injection vector and is unchanged.Testing
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/trigger-codepipeline.yml'))"-> parses OK- Confirmed no
${{ github.* }}interpolation remains inside therun:block.
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
AWS Toolkit Common
This repo contains shared components for the AWS Toolkits for
Contributers looking to contribute to the above projects should consult the contributing guide (CONTRIBUTING.md) on the repos they are interested in: this repo contains internal components that most contributers would find boring.
Components
Telemetry
Telemetry is the first shared component in this repository. Read about telemetry here.
License
This project is licensed under the Apache-2.0 License.