Repository navigation
ci(codeql): skip py/log-injection on full Python scans - #44001
pylaterreur wants to merge 1 commit into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
05fd771 to
77b92d0
Compare
Analyze (python) fails on every CodeQL run for main that is not cancelled. The py/log-injection query hits CodeQL's 2 GiB result-set limit after 10 to 15 minutes, and that one failure throws away the results of the other 167 Python queries. No full Python scan has finished since March 11: nightly runs hit the 30 minute job timeout until July 8 and have failed on this query since July 9 Pull request scans are diff-informed, so the same query finishes there in about a minute and a half, and BerriAI#41142 kept py/log-injection for those findings. The new step drops it from push and schedule runs only, before CodeQL reads the config. codeql-config.yml already excludes two other queries from every run for passing the same limit tests/unit/test_codeql_workflow.py checks that the step runs only on full Python scans, then runs its yq command on a copy of codeql-config.yml and checks that it adds that one exclusion and changes nothing else
77b92d0 to
8b47fd3
Compare
|
This got closed automatically when #44426 was merged: its description says "separate fix #44001 remains open", and GitHub reads "fix #44001" as a closing keyword. The problem is still there: the latest Python CodeQL run on main still fails on py/log-injection ("Result set is larger than the limit of 2GiB", https://github.com/BerriAI/litellm/actions/runs/37180796266). I can't reopen it myself; @moe-berri, could you reopen it, please? |
TLDR
Problem this solves:
How it solves it:
No full Python scan has finished since March 11. The nightly runs hit the job's 30 minute timeout until July 8, and since July 9 the push and nightly runs fail on this one query, in all 25 runs I sampled up to October 1. Pull request scans are diff-informed, so the same query finishes there in about a minute and a half and keeps reporting log-injection findings on changed lines
User Flow
Before: every merge to main gets a red CodeQL check, and Python code scanning never gets results from main
Query failed: codeql/python-queries/Security/CWE-117/LogInjection.ql (Result set is larger than the limit of 2GiB)After: the push scan finishes and main's Python results reach code scanning
Relevant issues
#41142 kept py/log-injection on purpose for the findings it reports on pull requests. This keeps those and only drops the query where it can't finish
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)tests/unit/test_codeql_workflow.pylocks the change in. One test checks that the step runs only on full Python scans. The other runs the step's own yq command on a copy of codeql-config.yml, and checks that it appends the py/log-injection exclusion and changes nothing else. Each fails if the step also runs on pull requests, excludes another query, or is removed. The misc shard runs it on runners that ship yq.check_workflow_startup_safety.py,check_workflow_job_name_collisions.pyandassert_workflow_dir_hygiene.pypass, and actionlint 1.7.12 and zizmor 1.24.1 with online audits report nothing newDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
CodeQL only runs full scans on pushes to main and on its nightly schedule, so this PR's own checks can't run one. Before uses main's runs, and After shows the config the full scan will read and the evidence that the other 167 queries already finish
Before (aa601ce)
Push scan
[168/168 eval 13m36s] Query failed: codeql/python-queries/Security/CWE-117/LogInjection.ql (Result set is larger than the limit of 2GiB)and1 of 168 queries failed to evaluateError running analysis for pythonwithExit code was 34, and the job fails after 19 minutesPull request scan
Calculating diff ranges for main...BerriAI:litellm_ci_stale_tests_1001, then[125/168 eval 1m24s] Evaluation done; writing results to codeql/python-queries/Security/CWE-117/LogInjection.bqrsAfter (8b47fd3)
Push scan
yq -i '.query-filters += [{"exclude": {"id": "py/log-injection"}}]' .github/codeql/codeql-config.ymlwith yq 4.53.6, the version on the ubuntu-24.04 runner image these jobs usequery-filterswithexclude: id: py/log-injection, and every other key and filter is unchangedPull request scan
matrix.language == 'python' && github.event_name != 'pull_request'Calculating diff ranges for main...pylaterreur:fix-codeql-full-scan-log-injection, then[126/168 eval 1m34s] Evaluation done; writing results to codeql/python-queries/Security/CWE-117/LogInjection.bqrs, and passes in 8 minutesType
Infrastructure
Caveats (if any)
Medium
Low
Final Attestation