ci: add static analysis pipeline gate - #44
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
static-analysisGitHub Actions job after the Python test gatesrcandtoolswith the project CLI and write separate JSON reportssample_appfixture without treating its expected finding exit code as an infrastructure failurereports/cioutputWhy
Backlog 5.2 requires the static analyzer to run as an enforceable pull-request gate. The repository already had a Python 3.11 pytest workflow, but analyzer behavior was only validated locally and the deliberately vulnerable demo could not be invoked directly in CI without handling its expected exit code.
Gate behavior
Project sources
The job generates:
reports/ci/static-analysis-src.jsonreports/ci/static-analysis-tools.jsonBoth commands must exit successfully. The current static-analyzer CLI returns exit code
1for any finding, so this creates a zero-finding policy for the analyzer and dependency-scanner source trees.This is intentionally stricter than a severity-only gate. The static analyzer uses
INFO,WARNING, andERRORrather than the dependency scanner'sHIGHandCRITICALvocabulary.Controlled demo
The job also generates:
reports/ci/static-analysis-sample-app.jsonThe demo scan must return exit code
1, because the fixture contains five deliberate findings. CI then compares the generated document withreports/sample-app/static-analysis.jsonand runstests/test_sample_app_security_demo.py. An unexpected exit code, finding drift, or baseline mismatch fails the job.Security and operational impact
ubuntu-latestcontents: readValidation
Tests (Python 3.11)job on CPython 3.11.15: 988 passedStatic analysisjob: project and demo gates passed; 4 integration tests passedsrcandtools: 0 findingssample_app: exactly 5 expected findingsgit diff --check: passedFollow-up
Backlog 5.3 will add a deterministic fixture-backed dependency vulnerability gate. Backlog 5.4 will upload the static-analysis and dependency-scan JSON reports as GitHub Actions artifacts.