fix(compliance): claim "no violation found" only where a rule checked the code (#368) #385

Merged
sharang merged 1 commits from fix/cra-status-languages into main 2026-09-25 09:45:44 +00:00
Owner

Closes #368.

The CRA status used to call a covered control "no violation found" once any scan had completed, whatever code was scanned. On a C-only firmware repo, secure defaults, password hashing, session cookies and the grounded checks (cra-ai-1, 6, 7, 10–12, 14, 15, 24, 27–30) all read "no violation found", although only Python/JS rules check them. A customer would read that as a clean result for controls we never looked at.

Decision (2026-09-25)

Show "nicht bewertet" (not assessed), with the reason, unless a rule of the control actually covers the scanned code.

Changes

  • The scan run records its languages.
    • ScanRun.languages holds the source languages SAST saw outside vendor code (c, cpp, python, …).
    • The new pipeline::languages module works them out from file extensions, in the same blocking step as the vendor detection. It shares the vendor-aware walker, now in pipeline/vendor.rs.
    • A run that scans several trees collects them all ($addToSet).
  • Each binding in the control map declares its languages, taken from each rule's languages::
    • semgrep rules: their own languages. CWE-bound registry rules: the registry's main languages, not C/C++.
    • The grounded check: the file types it reads today. That excludes C/C++ until #376.
    • cppcheck: c and cpp.
    • gitleaks, syft and osv are language-independent. A test enforces that only these may have an empty list.
  • Status. "No violation found" requires a binding that applies to the scanned languages (ControlEntry::checked_for). Otherwise the state is "not assessed", with a reason:
    • not_scanned
    • no_tool
    • no_rule_for_languages (listing them)
    • languages_unknown, for runs from before this change. There, only language-independent tools count.
  • Dashboard.
    • The CRA page shows the reason per control and "Geprüfte Sprachen: C, Python" next to the last scan.
    • The state label is now "Nicht bewertet" / "Not assessed".

The control map's hash in the evidence manifest changes with this.

Checked

  • cargo fmt --all --check.
  • clippy with the CI flags for control-map, compliance-core, compliance-agent and the dashboard (server, web).
  • Tests: agent 426, core 98, control-map 12, dashboard 48 / 32. New tests cover a C-only scan, a mixed scan, unknown languages, not scanned, bindings per language, language detection outside vendor code, and the DE/EN reason texts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Closes #368. The CRA status used to call a covered control **"no violation found"** once any scan had completed, whatever code was scanned. On a C-only firmware repo, secure defaults, password hashing, session cookies and the grounded checks (cra-ai-1, 6, 7, 10–12, 14, 15, 24, 27–30) all read "no violation found", although only Python/JS rules check them. A customer would read that as a clean result for controls we never looked at. ## Decision (2026-09-25) Show "nicht bewertet" (not assessed), with the reason, unless a rule of the control actually covers the scanned code. ## Changes - **The scan run records its languages.** - `ScanRun.languages` holds the source languages SAST saw outside vendor code (`c`, `cpp`, `python`, …). - The new `pipeline::languages` module works them out from file extensions, in the same blocking step as the vendor detection. It shares the vendor-aware walker, now in `pipeline/vendor.rs`. - A run that scans several trees collects them all (`$addToSet`). - **Each binding in the control map declares its languages**, taken from each rule's `languages:`: - semgrep rules: their own languages. CWE-bound registry rules: the registry's main languages, not C/C++. - The grounded check: the file types it reads today. That excludes C/C++ until #376. - cppcheck: `c` and `cpp`. - gitleaks, syft and osv are language-independent. A test enforces that only these may have an empty list. - **Status.** "No violation found" requires a binding that applies to the scanned languages (`ControlEntry::checked_for`). Otherwise the state is "not assessed", with a reason: - `not_scanned` - `no_tool` - `no_rule_for_languages` (listing them) - `languages_unknown`, for runs from before this change. There, only language-independent tools count. - **Dashboard.** - The CRA page shows the reason per control and "Geprüfte Sprachen: C, Python" next to the last scan. - The state label is now "Nicht bewertet" / "Not assessed". The control map's hash in the evidence manifest changes with this. ## Checked - `cargo fmt --all --check`. - clippy with the CI flags for control-map, compliance-core, compliance-agent and the dashboard (`server`, `web`). - Tests: agent 426, core 98, control-map 12, dashboard 48 / 32. New tests cover a C-only scan, a mixed scan, unknown languages, not scanned, bindings per language, language detection outside vendor code, and the DE/EN reason texts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-09-25 08:43:30 +00:00
fix(compliance): claim "no violation found" only where a rule checked the code (#368)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 7m30s
dee24610f8
The CRA status called every covered control clean once a scan had
completed, even when none of its rules covers the scanned code (a C
repo and Python-only rules). The scan run now records the source
languages it saw outside vendor code, each control-map binding
declares its languages, and a control is "no violation found" only if
a binding applies; otherwise it is not assessed, with the reason.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 62da6dbbf7 into main 2026-09-25 09:45:44 +00:00
Sign in to join this conversation.