Skip to main content

Code scanning in CI

Run one static discovery scan in your own pipeline and retain JSON evidence, SARIF and a coverage summary. Local CI scanning needs Python 3.12 or later and the reviewed source bundle. The scan itself needs no repository API token or network access. Scanner 0.26.16 adds pinned parser wheels for JavaScript and TypeScript; install them in an isolated environment before scanning. It reads the checked-out source without importing it, installing its dependencies or running its build.

Get running​

Exact algorithm names​

Scanner 0.26.8 preserves all 18 standardized parameter-set names: ML-KEM-512/768/1024, ML-DSA-44/65/87, and SLH-DSA with SHA2 or SHAKE and 128s/128f/192s/192f/256s/256f. Hyphenated, underscored and compact spellings are normalized to canonical names. For example, ml_kem_768 becomes ML-KEM-768. Multiple parameter sets on the same line remain separate findings, including in JSON and SARIF. Bare ML-KEM remains a family with unspecified parameters. Unsupported suffixes are not silently converted to a recognized parameter set; Kyber, Dilithium and SPHINCS+ names are not treated as aliases for finalized standards.

These are static candidates. Languages still using text patterns may report a name in a string or comment; this does not verify execution, implementation conformance, deployed configuration or quantum readiness. Python uses call analysis and does not report ordinary comments or string-only mentions. JavaScript/TypeScript in scanner 0.26.16 also uses syntax parsing, with direct Node crypto import resolution and separate lower-confidence unresolved call-name candidates. Unresolved calls keep usage unknown; variable arguments do not establish an algorithm identity. Hybrid/composite identifier coverage is a separate capability.

The parameter reference tables are FIPS 203, FIPS 204, and NIST SLH-DSA parameter sets. This behavior ships in the hosted repository scanner and source bundle. Check the reported scanner version when using compiled agents; older binaries keep their previous detectors until updated.

Run a scan​

  1. Download the signed source bundle from Agents, then Downloads and verify it using the distribution guide. Review it before execution. Pin the reviewed version in your repository; do not download an unverified latest script in CI.
  2. Extract the complete bundle into vendor/quantum-ready/. Keep integrations/ and scanner/ beside each other. The scanner excludes vendor/, so its own implementation is not counted as application evidence. Before committing the reviewed files, add the following lines to your repository's .gitattributes to preserve their verified bytes instead of applying Git line-ending conversion:
/vendor/quantum-ready/** -text
/.github/workflows/quantum-ready.yml -text

Keep any existing .gitattributes rules. Add these entries before the first git add of the bundle. If it was already committed with converted line endings, restore the verified archive's files and restage them with these rules in place.

  1. Run from your repository root:
QSCAN_PYTHON_ENV="$(mktemp -d /tmp/qscan-parser.XXXXXX)"
python -I -m venv "$QSCAN_PYTHON_ENV"
"$QSCAN_PYTHON_ENV/bin/python" -I -m pip --isolated install --only-binary=:all: --no-deps --require-hashes -r vendor/quantum-ready/scanner/locks/javascript-parsers.txt -r vendor/quantum-ready/scanner/locks/go-parser.txt
"$QSCAN_PYTHON_ENV/bin/python" -I vendor/quantum-ready/integrations/ci-scan.py . --output-dir .quantum-ready-results

Use a fresh output directory for each run. Existing directories are rejected to prevent stale reports being mistaken for current results. These commands target Linux/macOS with Python 3.12. The -I flag excludes repository imports and Python environment overrides; the isolated environment contains only reviewed parser wheels. Do not add -S for JavaScript/TypeScript scans because it hides those installed dependencies. Missing parser dependencies produce incomplete coverage, not a fallback text scan. For offline setup, pre-download the hash-locked wheels and add --no-index --find-links /path/to/wheels to the installation command. Older bundles without the parser lock retain their previous detector behavior. Optional --source sets a nonsecret source label; --commit accepts an exact lowercase 40- or 64-character Git hash. A CI-supplied commit is metadata, not proof that the working tree is unchanged.

Choose your pipeline​

GitHub Actions​

Copy vendor/quantum-ready/integrations/github-actions.yml to .github/workflows/quantum-ready.yml. The template checks out the repository with persisted credentials disabled, uses read-only repository permissions, and pins third-party actions to reviewed commit hashes. Scan output is retained as a 14-day artifact even when coverage is incomplete.

Download quantum-ready-findings from the run to inspect all three reports. This template does not automatically upload to GitHub's code-scanning security tab. SARIF ingestion requires the appropriate repository features and permissions; see GitHub's upload documentation.

GitHub-hosted execution was verified on November 4, 2026 with the unchanged template from signed source bundle 0.51.564 / sequence 844. All 256 vendored files matched their signed hashes after committing. A one-file Python fixture produced one SHA-1 static candidate, complete coverage and downloadable JSON, SARIF and summary reports. Fixture source was not executed. This verifies the hosted runner and artifact path for that bounded example; optional workspace upload and GitHub security-tab ingestion were not exercised.

GitLab CI​

Include the vendored template from your existing .gitlab-ci.yml:

include:
- local: vendor/quantum-ready/integrations/gitlab-ci.yml

The template uses the test stage; add that stage or change both jobs to a stage in your pipeline. Its Python image is pinned by digest. Downloadable artifacts are retained for 14 days, including on a failed scan. SARIF report ingestion requires a supported GitLab version and subscription: consult GitLab SARIF support. On older installations that reject the SARIF report keyword, remove only artifacts.reports; keep artifacts.paths and when: always to retain downloadable reports.

GitLab ingests security findings only from a successful job. An incomplete scan intentionally fails and retains its diagnostic artifacts; do not suppress its exit code to make coverage look complete. Actual GitLab-hosted execution and provider ingestion remain pending acceptance.

Understand the outcome​

Exit 0: completed​

The static scan completed within its supported scope. Review findings and skipped-file counts. Zero findings is not a quantum-readiness certification.

Exit 2: incomplete coverage​

Read JSON diagnostics and SARIF invocation status. Fix parse errors or reduce scope, then rerun. All three reports are retained.

Exit 1: failed​

Scan/report creation failed, or arguments/output are invalid. Inspect the job log. A failed summary.json is written when report-directory creation succeeded.

Your reports​

  • observations.json: discovery evidence, paths, file hashes and bounded coverage diagnostics.
  • quantum-ready.sarif: SARIF 2.1.0 static candidates, encoded relative locations, stable fingerprints and invocation coverage.
  • summary.json: machine-readable completion state, finding count, scanned/skipped counts and error count.

An invalid command or inability to create the output directory may leave no artifacts. A cancelled or timed-out runner may also prevent artifact retention. Never treat missing output as a clean scan. SARIF candidates use note-level severity: runtime use, exploitability and key usage have not been verified. Reports contain paths and metadata, not raw source; set artifact access and retention for your repository's sensitivity.

The scanner is bounded to 10,000 supported files and 180 seconds. Ordinary source files have a 1,000,000-byte limit; supported lockfiles have a 5,000,000-byte limit. Generated, dependency and environment directories such as vendor, node_modules, .git, dist, build and virtual environments are excluded. File and diagnostic counts describe this supported static scope, not whole-application runtime coverage. See repository scanning for interpretation and hosted scanning.

Optional evidence upload​

Both templates default to local artifacts only. To send complete evidence to your workspace, create a dedicated ingestor credential, set QR_ENDPOINT and QR_TOKEN as CI secrets, and explicitly enable QSCAN_UPLOAD_EVIDENCE=true (a GitHub repository variable or GitLab CI variable). Never use an administrator or agent credential.

The templates permit upload only after successful scans on pushes to the default branch. Protect that branch and review workflow changes. In GitLab, mark variables protected and masked, and ensure protected variables are unavailable to untrusted merge-request pipelines. A rule on the upload job alone does not isolate project-level secrets from other jobs. GitHub secrets are referenced only in the trusted upload step; do not change this to pull_request_target execution of untrusted source.

Standalone evidence upload creates ingestion evidence; it does not create or attach a hosted repository-scan operation. Actual provider-side artifact/SARIF ingestion and CI credential acceptance must be checked in your own pipeline. Schema validation alone is not proof of successful provider ingestion.

Troubleshooting​

  • Output already exists: choose a new directory or remove only the previous disposable report directory before starting a new run. Never reuse stale output.
  • Incomplete with no findings: open observations.json diagnostics; a malformed supported manifest or source parse error is a coverage failure.
  • Reports absent: check checkout/setup failure, runner cancellation, output permissions and command arguments before drawing conclusions.
  • SARIF visible as a download but absent from security results: check provider feature availability, upload configuration, permissions and job success separately.
  • Upload denied: check that the endpoint is the intended workspace and the credential has the ingestor role. Do not broaden it to admin.

Diagnose a failed CI invocation​

With scanner 0.27.9, add --debug to request redacted failure frames on stderr:

python integrations/ci-scan.py ./source --output-dir ./new-reports --debug

Use a new output directory for each invocation. Debugging does not change the existing exit statuses: 0 for complete analysis, 2 for incomplete analysis, and 1 for command/report failure. A failure after report-directory creation retains the failed summary.json; argument failures may occur before any report exists.

The diagnostic output omits exception values, locals, source lines and external paths. Missing optional modules produce fixed repair guidance. Do not interpret a traceback, an empty findings list or missing reports as successful analysis. Keep the exit status and coverage diagnostics alongside the reports when investigating.

Go modules​

Scanner 0.25.3 includes Go module declarations in evidence and SARIF. Unresolved local replacements and workspaces keep findings available while marking coverage incomplete and returning exit 2. No Go installation, module download, or build execution is required.

.NET dependency evidence​

Scanner 0.26.0 reads NuGet project declarations and packages.lock.json without running .NET, restoring packages or executing project code. Include the project and lockfile in the approved scan root. Central versions, MSBuild conditions and imports can yield nuget-scope-unresolved; retain the findings and coverage warnings rather than treating the run as clean. See .NET and NuGet discovery for formats, interpretation and limits.

Yarn and pnpm lockfiles​

Use scanner 0.26.91 or later to include supported yarn.lock and pnpm-lock.yaml records. The parser is bundled; no Yarn, pnpm or separate YAML installation is needed. Keep lockfiles inside the approved scan root. Partial or unsupported records appear in coverage diagnostics and cause the existing incomplete-analysis exit status of 2. See supported formats and interpretation.