upload-sarif: token input doesn't work
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
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- github-actions, typescript
Hướng nghiên cứu
Bắt đầu với đầu vào token của upload-sarif action và yêu cầu GitHub API được sử dụng để tải lên SARIF; so sánh yêu cầu đó với lệnh gọi curl thành công đến endpoint code-scanning của repository. Tái hiện lỗi bằng workflow được cung cấp và xác minh rằng token đã được cấu hình cho phép hoàn tất việc tải lên mà không gặp lỗi Not Found.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have this step in a workflow and it works:
- name: "Upload Trivy scan results to GitHub Security tab"
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: '${{ env.trivy_output_file }}'
category: 'trivy-image-${{ matrix.image }}'
but it doesn't work if add the token argument:
- name: "Upload Trivy scan results to GitHub Security tab"
uses: github/codeql-action/upload-sarif@v3
with:
token: ${{ secrets.MY_TOKEN }}
sarif_file: '${{ env.trivy_output_file }}'
category: 'trivy-image-${{ matrix.image }}'
This is the error:
Uploading results
Processing sarif files: ["trivy-test-yellow.sarif"]
Validating trivy-test-yellow.sarif
Combining SARIF files using the CodeQL CLI
Adding fingerprints to SARIF file. For more information, see https://docs.github.com/en/enterprise-cloud@latest/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning#providing-data-to-track-code-scanning-alerts-across-runs
Uploading results
Warning: Not Found
Error: Not Found
Debug
Uploading results
Processing sarif files: ["trivy-test-yellow.sarif"]
Validating trivy-test-yellow.sarif
Combining SARIF files using the CodeQL CLI
Adding fingerprints to SARIF file. For more information, see https://docs.github.com/en/enterprise-cloud@latest/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning#providing-data-to-track-code-scanning-alerts-across-runs
##[debug]Validating that each SARIF run has a unique category
##[debug]Serializing SARIF for upload
##[debug]Compressing serialized SARIF
##[debug]Raw upload size: 542 bytes
##[debug]Base64 zipped upload size: 472 bytes
##[debug]Number of results in upload: 0
Uploading results
Warning: Not Found
Error: Not Found
##[debug]Sending status report: {"action_name":"upload-sarif","action_oid":"unknown","action_ref":"v3","action_started_at":"2024-07-24T13:50:22.018Z","action_version":"3.25.13","analysis_key":".github/workflows/build new.yml:build","commit_oid":"f26f5724a7c97d43f52ce8d4c9c0ed09b5eeba51","first_party_analysis":false,"job_name":"build","job_run_uuid":"","ref":"refs/heads/main","runner_os":"Linux","started_at":"2024-07-24T13:50:22.018Z","status":"failure","steady_state_default_setup":false,"testing_environment":"","workflow_name":"builed new","workflow_run_attempt":1,"workflow_run_id":100[77](https://github.com/my..repo.../actions/runs/10077937806/job/27861647308#step:9:78)937806,"actions_event_name":"workflow_dispatch","runner_available_disk_space_bytes":21029244928,"runner_total_disk_space_bytes":7[78](https://github.com/my..repo.../actions/runs/10077937806/job/27861647308#step:9:79)51254784,"cause":"Not Found","exception":"HttpError: Not Found\n at /home/runner/work/_actions/github/codeql-action/v3/node_modules/@octokit/request/dist-node/index.js:86:21\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async requestWithGraphqlErrorHandling (/home/runner/work/_actions/github/codeql-action/v3/node_modules/@octokit/plugin-retry/dist-node/index.js:71:20)\n at async Job.doExecute (/home/runner/work/_actions/github/codeql-action/v3/node_modules/bottleneck/light.js:405:18)","completed_at":"2024-07-24T13:50:22.[81](https://github.com/my..repo.../actions/runs/10077937806/job/27861647308#step:9:82)3Z","matrix_vars":"{\n \"dockerfile\": \"Dockerfile-ok\",\n \"image\": \"test/yellow\"\n}","runner_arch":"X64","runner_image_version":"20240721.1.0"}
##[debug]Node Action run completed with exit code 1
##[debug]CODEQL_ACTION_FEATURE_MULTI_LANGUAGE='false'
##[debug]CODEQL_ACTION_FEATURE_SANDWICH='false'
##[debug]CODEQL_ACTION_FEATURE_SARIF_COMBINE='true'
##[debug]CODEQL_ACTION_FEATURE_WILL_UPLOAD='true'
##[debug]CODEQL_ACTION_VERSION='3.25.13'
##[debug]CODEQL_ACTION_ANALYSIS_KEY='.github/workflows/build new.yml:build'
##[debug]CODEQL_WORKFLOW_STARTED_AT='2024-07-24T13:50:22.018Z'
##[debug]CODEQL_UPLOAD_SARIF_TRIVY_IMAGE_TEST_YELLOW__TRIVY='CODEQL_UPLOAD_SARIF_TRIVY_IMAGE_TEST_YELLOW__TRIVY'
##[debug]CODEQL_ACTION_JOB_STATUS='JOB_STATUS_FAILURE'
##[debug]Finishing: Upload Trivy scan results to GitHub Security tab
The secret is properly configured. If I change the secret value, I got "Bad credentials". I created this step to check the token and it works:
- name: testing secrets
env:
MY_TOKEN: ${{ secrets.MY_TOKEN }}
run: |
REPOSITORY=".../..."
# Variables
BASE_URL="https://api.github.com/repos/$REPOSITORY/code-scanning"
HEADERS=(
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer $MY_TOKEN"
-H "X-GitHub-Api-Version: 2022-11-28"
)
curl -Ls \
-X GET \
"${HEADERS[@]}" \
"$BASE_URL/analyses?per_page=1"
- Ngôn ngữ chính
- TypeScript
- Star
- 1.6k
- Fork
- 493
- Merge trung bình
- 1 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 44
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/codeql-action
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
github/codeql-action#4052 · 4 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
github/codeql-action#4078 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
github/codeql-action#4008 · 9 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
github/codeql-action#3978 · 4 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
github/codeql-action#3915 · 6 bình luận · 3 reaction ·
Tất cả issue của github/codeql-action
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
dennys-bd/agent-hive#184 ·
-
Add: hunch Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
AbdelStark/awesome-typesafe#104 ·
-
ai-observability bug team/ai-observability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vicharanashala/fln#563 ·