T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:438
- Finding
- Privileged CI/CD Workflows Use Mutable Third-Party Action References<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 438-499 and 612-617 **Vulnerability Type**: Supply-chain risk caused by mutable GitHub Actions references **Risk Level**: Medium ### Vulnerable Code ```yaml permissions: id-token: write # OIDC contents: read pull-requests: write # PR comments ``` ```yaml steps: - uses: actions/checkout@v4 - uses: hashicorp/setup-terraform@v3 ``` ```yaml steps: - uses: actions/checkout@v4 - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::role/terraform-ci aws-region: us-east-1 - uses: hashicorp/setup-terraform@v3 - working-directory: infrastructure/environments/${{ matrix.environment }} run: | terraform init terraform plan -out=tfplan -no-color - uses: actions/upload-artifact@v4 with: name: tfplan-${{ matrix.environment }} path: infrastructure/environments/${{ matrix.environment }}/tfplan ``` ```yaml steps: - uses: actions/checkout@v4 - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::role/terraform-ci aws-region: us-east-1 - uses: hashicorp/setup-terraform@v3 - uses: actions/download-artifact@v4 with: name: tfplan-${{ matrix.environment }} path: infrastructure/environments/${{ matrix.environment }} - working-directory: infrastructure/environments/${{ matrix.environment }} run: terraform apply tfplan ``` The drift-detection example repeats the same pattern: ```yaml steps: - uses: actions/checkout@v4 - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::role/terraform-ci aws-region: us-east-1 - uses: hashicorp/setup-terraform@v3 ``` ### Technical Analysis The workflow references third-party GitHub Actions through major-version tags such as `@v3` and `@v4`. These tags are mutable references rather than immutable commit identifiers. If an action repository or its releas ...[truncated 2352 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin every GitHub Action to a reviewed, full commit SHA: ```yaml - uses: actions/checkout@<full-reviewed-commit-sha> # v4.x.x - uses: aws-actions/configure-aws-credentials@<full-reviewed-commit-sha> # v4.x.x - uses: hashicorp/setup-terraform@<full-reviewed-commit-sha> # v3.x.x ``` 2. Use Dependabot or Renovate to propose reviewed SHA updates while retaining an adjacent release-version comment for readability. 3. Move permissions from workflow scope to individual jobs. Only jobs that actually authenticate to AWS should receive `id-token: write`. 4. Remove `pull-requests: write` from jobs that do not post pull-request comments. 5. Use distinct least-privilege IAM roles for planning, drift detection, and applying changes. The plan and drift roles should be read-only wherever possible. 6. Use separate roles and approval environments for development, staging, and production. 7. Ensure production environment protection requires authorized reviewers and prevents untrusted branches from invoking the production role. 8. Consider artifact attestations, strict artifact retention, and verification controls before applying a downloaded Terraform plan. ]]>
