C/C++ trees got only semgrep --config=auto, which found nothing in firmware code, and no fixture had ever produced a C finding. A semgrep run that failed returned no findings, so the scan looked like clean code.
What
cppcheck (Debian bookworm package, added to the image and to tool-versions.json):
runs on C/C++ trees with -I for the project's inc/include directories, -j2 and a 900 s timeout;
the source list goes in through --file-list, so vendor code is left out without skipping a customer's own app/Drivers/;
XML v2 becomes findings with CWE, a relative file:line and a snippet;
a failure is recorded as the sast_c_cpp skipped stage.
CRA C rules in cra_semgrep.yaml, bound in the control map:
cra-ai-20: unbounded string functions, scanf("%s"), non-literal format strings (WARNING);
cra-ai-8: hard-coded credentials;
cra-ai-13: MD5, SHA-1 and DES (OpenSSL, mbedTLS, wolfSSL);
cra-ai-16: rand() used for keys, nonces and tokens;
cppcheck's memory-safety CWEs are bound under cra-ai-20.
Vendor code is left out of SAST: STM32Cube Drivers/ (only when it sits next to Core/), CMSIS, *_HAL_Driver, *_StdPeriph_Driver, third_party, vendor. The run records which directories as sast_vendor_code; the SBOM still covers them. A customer's own src/drivers/ and Zephyr's boards/vendor/ are kept.
semgrep:
--jobs 2;
a run with no report is now a recorded sast skipped stage;
paths are relative to the tree. The fingerprint uses that path, so existing findings on uploaded archives are created once more on their next scan;
snippets are read from the file, because open-source semgrep only returns requires login.
Verification
New nightly target fw-c-sensor-node: every planted flaw is found, and the strcpy in the vendored HAL is not:
Closes #334. Part of the pilot P0 (#338).
## Why
C/C++ trees got only `semgrep --config=auto`, which found nothing in firmware code, and no fixture had ever produced a C finding. A semgrep run that failed returned no findings, so the scan looked like clean code.
## What
- **cppcheck** (Debian bookworm package, added to the image and to `tool-versions.json`):
- runs on C/C++ trees with `-I` for the project's `inc`/`include` directories, `-j2` and a 900 s timeout;
- the source list goes in through `--file-list`, so vendor code is left out without skipping a customer's own `app/Drivers/`;
- XML v2 becomes findings with CWE, a relative file:line and a snippet;
- a failure is recorded as the `sast_c_cpp` skipped stage.
- **CRA C rules** in `cra_semgrep.yaml`, bound in the control map:
- `cra-ai-20`: unbounded string functions, `scanf("%s")`, non-literal format strings (WARNING);
- `cra-ai-8`: hard-coded credentials;
- `cra-ai-13`: MD5, SHA-1 and DES (OpenSSL, mbedTLS, wolfSSL);
- `cra-ai-16`: `rand()` used for keys, nonces and tokens;
- cppcheck's memory-safety CWEs are bound under `cra-ai-20`.
- **Vendor code** is left out of SAST: STM32Cube `Drivers/` (only when it sits next to `Core/`), CMSIS, `*_HAL_Driver`, `*_StdPeriph_Driver`, `third_party`, `vendor`. The run records which directories as `sast_vendor_code`; the SBOM still covers them. A customer's own `src/drivers/` and Zephyr's `boards/vendor/` are kept.
- **semgrep**:
- `--jobs 2`;
- a run with no report is now a recorded `sast` skipped stage;
- paths are relative to the tree. The fingerprint uses that path, so existing findings on uploaded archives are created once more on their next scan;
- snippets are read from the file, because open-source semgrep only returns `requires login`.
## Verification
- New nightly target `fw-c-sensor-node`: every planted flaw is found, and the `strcpy` in the vendored HAL is not:
- cppcheck `arrayIndexOutOfBounds`, `uninitvar`, `memleak`;
- all six CRA C rules.
- The full local nightly (bless, then compare on a second fresh DB) passes. No other baseline changed, after the `boards/vendor` fix.
- `cargo fmt --check`; clippy with the CI flags; `compliance-agent` lib tests (382) and `control-map` tests pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
C/C++ trees got only `semgrep --config=auto`, which returned nothing for
firmware code, and a failed semgrep run read as clean code.
- cppcheck (bookworm package) runs on C/C++ trees with the project's include
directories, and its findings carry CWE, file:line and a snippet.
- Our own CRA C rules: unbounded string functions, scanf %s, non-literal
format strings, hard-coded credentials, broken hashes/ciphers and rand()
for keys and nonces, bound to cra-ai-8/13/16/20 in the control map, with
cppcheck's memory-safety CWEs under cra-ai-20.
- Vendor SDK code (STM32Cube Drivers/, CMSIS, *_HAL_Driver, third_party) is
left out of SAST and the run records which directories; the SBOM still
covers it. A customer's own drivers/ and Zephyr's boards/vendor are kept.
- semgrep: --jobs 2; a run with no report becomes a recorded skipped stage;
paths are relative to the tree, and snippets are read from the file
(open-source semgrep only returns "requires login").
- Nightly fixture fw-c-sensor-node: every planted flaw is found, and the
strcpy in the vendored HAL is not.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #334. Part of the pilot P0 (#338).
Why
C/C++ trees got only
semgrep --config=auto, which found nothing in firmware code, and no fixture had ever produced a C finding. A semgrep run that failed returned no findings, so the scan looked like clean code.What
tool-versions.json):-Ifor the project'sinc/includedirectories,-j2and a 900 s timeout;--file-list, so vendor code is left out without skipping a customer's ownapp/Drivers/;sast_c_cppskipped stage.cra_semgrep.yaml, bound in the control map:cra-ai-20: unbounded string functions,scanf("%s"), non-literal format strings (WARNING);cra-ai-8: hard-coded credentials;cra-ai-13: MD5, SHA-1 and DES (OpenSSL, mbedTLS, wolfSSL);cra-ai-16:rand()used for keys, nonces and tokens;cra-ai-20.Drivers/(only when it sits next toCore/), CMSIS,*_HAL_Driver,*_StdPeriph_Driver,third_party,vendor. The run records which directories assast_vendor_code; the SBOM still covers them. A customer's ownsrc/drivers/and Zephyr'sboards/vendor/are kept.--jobs 2;sastskipped stage;requires login.Verification
fw-c-sensor-node: every planted flaw is found, and thestrcpyin the vendored HAL is not:arrayIndexOutOfBounds,uninitvar,memleak;boards/vendorfix.cargo fmt --check; clippy with the CI flags;compliance-agentlib tests (382) andcontrol-maptests pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p