目录
Laxman Reddy

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). The github.event.head_commit.author.name context value was interpolated directly via ${{ }} into the inline run: 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 on main, the workflow runs the injected command. This job has id-token: write and assumes GitHubActionsCodePipelineRole, 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 PackagePipeline

Note: the if: condition on the job also references head_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 the run: block.
11天前1183次提交

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.

邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号