-
Notifications
You must be signed in to change notification settings - Fork 351
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
Analysis upload fails with rejecting SARIF, as there are more threadflow steps per result than allowed (19350 > 10000)
#1245
Comments
Hello! Thanks for reporting this. The first thing to do would be to figure out which rules/alerts are causing the problem. As an immediate fix you could remove the problematic alerts using https://github.com/advanced-security/filter-sarif . Could you Once you obtained the SARIF file, could you run the following
|
You were right, I had to use the main ref instead of the pinned SHAs to get the artifacts, so thanks for that!
https://gist.github.com/mrc0mmand/d516a60a02c2f15b9bbfeac9b589f8bd In case a further inspection is needed, I also uploaded the SARIF file to https://mrc0mmand.fedorapeople.org/gh_2022-09-14-cpp.sarif |
Thanks for all the details! The tail of the second
You could try to add a advanced-security/filter-sarif to filter out the Alternatively, you could use a I'll let the team know about this too, so they can investigate the issue and perhaps improve the queries to avoid them producing that much data. |
There is a new feature in code-scanning that allows you to remove queries from the analysis. Using this feature should remove the queries that are causing the problems. The documentation for this feature has not yet been published, but I will explain how to use it here.
query-filters:
- exclude:
id:
- cpp/unbounded-write
- cpp/path-injection That should be enough. |
Thank you both for the suggestions. I tried filtering the SARIF file using Using a CodeQL config file to disable the checks completely would also be an option (and would be probably much easier, given we already utilize such config file), but I'd like to avoid that, since both checks seem quite useful (especially in systemd's case). On a related note - is this issue caused by some limitations of the SARIF format or it's limited somewhere in the CodeQL action? * updated config for reference---
# vi: ts=2 sw=2 et:
# SPDX-License-Identifier: LGPL-2.1-or-later
#
name: "CodeQL"
on:
pull_request:
branches:
- main
- v[0-9]+-stable
paths:
- '**/meson.build'
- '.github/**/codeql*'
- 'src/**'
- 'test/**'
- 'tools/**'
push:
branches:
- main
- v[0-9]+-stable
permissions:
contents: read
jobs:
analyze:
name: Analyze
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ matrix.language }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ['cpp', 'python']
steps:
- name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: Initialize CodeQL
uses: github/codeql-action/init@0c670bbf0414f39666df6ce8e718ec5662c21e03
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql-config.yml
queries: +security-extended,security-and-quality
- run: sudo -E .github/workflows/unit_tests.sh SETUP
- name: Autobuild
uses: github/codeql-action/autobuild@0c670bbf0414f39666df6ce8e718ec5662c21e03
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@0c670bbf0414f39666df6ce8e718ec5662c21e03
with:
upload: False
output: sarif-results
- name: Filter SARIF results
uses: advanced-security/filter-sarif@54b1ee6ebe059d29692bcc246e3c397e99176c6b
if: ${{ matrix.language == 'cpp' }}
with:
patterns: |
-src/basic/unit-name.c:cpp/unbounded-write
-src/libsystemd/sd-bus/sd-bus.c:cpp/unbounded-write
-src/test/test-fs-util.c:cpp/path-injection
input: sarif-results/cpp.sarif
output: sarif-results/cpp.sarif
- name: Upload SARIF results
uses: github/codeql-action/upload-sarif@0c670bbf0414f39666df6ce8e718ec5662c21e03
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif |
The issue is that the two queries are behaving badly and producing a large number of paths for an alert. Our team is still diagnosing why. This is producing a sarif file with a large number of threadflow steps. Our code-scanning processor has trouble with these kinds of files and it rejects them. |
Ah, I see, thank you for the explanation. I also just noticed how many alerts the |
If you have time, could you create an issue on |
That's definitely a good idea. After enabling the |
Hello!
Today I wanted to enhance our CodeQL scan in the systemd repo by using the
security-extended
andsecurity-and-quality
query sets, but after adding them the CodeQL action can no longer upload the resulting SARIF file:Example job: https://github.com/systemd/systemd/actions/runs/3053021449/jobs/4923112318
Configuration:
Since the build & analysis finishes successfully and only the last step fails, I don't think this is an issue on our side - is there something which can be done to mitigate this or we're out of luck?
Thank you!
The text was updated successfully, but these errors were encountered: