Skip to content

Actions: Fix Critical Artifact poisoning False Positive #19388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AdnaneKhan
Copy link

The artifact poisoning CodeQL query creates a Critical false-positive under the following scenario:

I believe this PR will fix it because it unless the path extraction functionality in CodeQL resolves/sanitizes the context values in some way.

Below is an example that reproduces the false positive:

name: Test False Positive
on:
  workflow_run:
    workflows:
      - Benchmark
    types:
      - completed

permissions:
  contents: read

jobs:
  benchmark:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Download From PR
        uses: actions/download-artifact@v4
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          run-id: ${{ github.event.workflow_run.id }}
          path: ${{ runner.temp }}/artifacts/
      - run: npm install

This is particularly a problem because the examples for a secure workflow specifically calls out this fix.

name: Secure Workflow

on:
  workflow_run:
    workflows: ["Prev"]
    types:
      - completed

jobs:
  Download:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: mkdir -p ${{ runner.temp }}/artifacts/
      - uses: dawidd6/action-download-artifact@v2
        with:
          name: pr_number
          path: ${{ runner.temp }}/artifacts/

      - name: Run command
        run: |
          sh cmd.sh

@Copilot Copilot AI review requested due to automatic review settings April 25, 2025 19:16
@AdnaneKhan AdnaneKhan requested a review from a team as a code owner April 25, 2025 19:16
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (1)
  • actions/ql/lib/codeql/actions/security/ArtifactPoisoningQuery.qll: Language not supported

@github-actions github-actions bot added the Actions Analysis of GitHub Actions label Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Analysis of GitHub Actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant