[actions] Alternate actions/checkout paths suppress untrusted-checkout alerts

Đang mở
#22,213 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
github-actions
Lĩnh vực
ci-cd, security

Hướng nghiên cứu

Bắt đầu với ActionsMutableRefCheckout.getPath() và ActionsSHACheckout.getPath() trong actions/ql/lib/codeql/actions/security/UntrustedCheckoutQuery.qll, sau đó so sánh chúng với LocalScriptExecutionRunStep.getPath() trong PoisonableSteps.qll. Sử dụng reproducer được liên kết để xác minh sự không khớp hiện tại, thêm coverage hồi quy cho các dạng đường dẫn được liệt kê và xác nhận rằng cả query Critical lẫn High đều báo cáo các trường hợp có đường dẫn thay thế, trong khi immutable checkout vẫn không được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description of the issue

actions/untrusted-checkout/critical does not report a privileged workflow that checks out an untrusted PR into a non-default path: and then executes a script or local action from that checkout. The actions/untrusted-checkout/high fallback is also suppressed, so neither query reports the workflow.

Minimal reproducer

on: pull_request_target

permissions:
  contents: write

jobs:
  execute:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          repository: ${{ github.event.pull_request.head.repo.full_name }}
          ref: ${{ github.event.pull_request.head.sha }}
          path: candidate
      - run: bash candidate/proof.sh

actions/checkout places path: candidate under $GITHUB_WORKSPACE, so this executes the same checked-out script relationship as a default checkout followed by bash proof.sh.

Reproduction

The complete reproducer is in public fork PR #1.

  • Latest-release fork CI: CodeQL Action 4.37.1, CLI 2.26.1, codeql/actions-queries 0.6.31
  • Current-main CI: queries compiled directly from github/codeql@14450f5bf38ea9a3ce2e0e45dcf51c0bbdd01af5

Both successful runs scanned all 11 workflow files and produced the same result matrix:

Case Result
Default checkout followed by bash proof.sh actions/untrusted-checkout/critical
Default checkout followed by uses: ./.github/actions/proof actions/untrusted-checkout/critical
Default checkout with quoted or $GITHUB_WORKSPACE script paths actions/untrusted-checkout/critical
path: candidate, ./candidate, or candidate/ followed by the corresponding script no critical or high alert
path: candidate followed by uses: ./candidate/.github/actions/proof no critical or high alert
Immutable checkout control no critical or high alert

The CI also executed harmless script and composite-action canaries through the tested paths before analysis.

Expected result

The alternate-path cases should be reported by actions/untrusted-checkout/critical, like their default-path controls. A path-representation mismatch should not suppress both the critical query and its high fallback.

Source-level cause

At current main:

Normalizing explicit actions/checkout paths at the checkout model, with regression tests for bare, dot-relative, trailing-slash, and local-action forms, appears to be the smallest fix.

Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
134

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/codeql

Tất cả issue của github/codeql

Issue tương tự

Thêm issue về DevOps

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.