fix(sast): recognise common embedded vendor layouts (#369) #386

Merged
sharang merged 1 commits from fix/vendor-layouts into main 2026-09-25 09:58:24 +00:00
Owner

Closes #369.

The vendor-code filter recognised only fixed names (CMSIS, Third_Party, vendor, …_HAL_Driver) and the STM32Cube Drivers/ next to Core/. Common embedded layouts slipped through, and SAST reported findings inside ST, Mbed TLS and lwIP code. For example, anon767/STM32F7HTTPS gave about 89 DES/MD5/SHA-1 hits inside Middlewares/mbedTLS.

New rules (compliance-agent/src/pipeline/vendor.rs)

  • ST's generated layouts, matched with ST's capitalisation. A customer's own lower-case middleware/ stays theirs.
    • Middlewares/ always. All of it is ST's: USB, FreeRTOS and third-party code alike.
    • Middleware/ and Drivers/ when they sit together, as in the FreeRTOS/ST reference projects (for example iot-reference-stm32u5).
  • The HAL without the _Driver suffix: STM32…_HAL, for example Drivers/STM32U5xx_HAL.
  • A vendored library wherever it sits, recognised by the files it always ships:
    • Mbed TLS 2.x/3.x;
    • lwIP;
    • the FreeRTOS kernel (tasks.c + include/FreeRTOS.h);
    • wolfSSL;
    • FatFs, flat or with its source/ folder.

Excluded folders are still listed on the scan run and still go into the SBOM. Only vendor.rs changes. It sits next to #385, which also edits this file (it adds walk_outside); whichever merges second needs a small rebase.

Nightly

fw-c-sensor-node and fw-embedded-libs keep their findings in Core/. embedded-libs only ever had Third_Party inside Middlewares/, so the baselines should not change.

Checked

  • cargo fmt --all --check.
  • clippy with the CI flags for compliance-agent.
  • Agent library tests: 431. New tests cover the FreeRTOS reference layout, Middlewares/ without Third_Party, library markers in lib/ and components/, and a customer's own lower-case middleware/ being kept.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Closes #369. The vendor-code filter recognised only fixed names (`CMSIS`, `Third_Party`, `vendor`, `…_HAL_Driver`) and the STM32Cube `Drivers/` next to `Core/`. Common embedded layouts slipped through, and SAST reported findings inside ST, Mbed TLS and lwIP code. For example, `anon767/STM32F7HTTPS` gave about 89 DES/MD5/SHA-1 hits inside `Middlewares/mbedTLS`. ## New rules (`compliance-agent/src/pipeline/vendor.rs`) - **ST's generated layouts, matched with ST's capitalisation.** A customer's own lower-case `middleware/` stays theirs. - `Middlewares/` always. All of it is ST's: USB, FreeRTOS and third-party code alike. - `Middleware/` and `Drivers/` when they sit together, as in the FreeRTOS/ST reference projects (for example `iot-reference-stm32u5`). - **The HAL without the `_Driver` suffix:** `STM32…_HAL`, for example `Drivers/STM32U5xx_HAL`. - **A vendored library wherever it sits,** recognised by the files it always ships: - Mbed TLS 2.x/3.x; - lwIP; - the FreeRTOS kernel (`tasks.c` + `include/FreeRTOS.h`); - wolfSSL; - FatFs, flat or with its `source/` folder. Excluded folders are still listed on the scan run and still go into the SBOM. Only `vendor.rs` changes. It sits next to #385, which also edits this file (it adds `walk_outside`); whichever merges second needs a small rebase. ## Nightly `fw-c-sensor-node` and `fw-embedded-libs` keep their findings in `Core/`. `embedded-libs` only ever had `Third_Party` inside `Middlewares/`, so the baselines should not change. ## Checked - `cargo fmt --all --check`. - clippy with the CI flags for compliance-agent. - Agent library tests: 431. New tests cover the FreeRTOS reference layout, `Middlewares/` without `Third_Party`, library markers in `lib/` and `components/`, and a customer's own lower-case `middleware/` being kept. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-09-25 09:47:56 +00:00
fix(sast): recognise common embedded vendor layouts (#369)
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 7m36s
82e85e0592
Middleware/ with Drivers/ (the FreeRTOS/ST reference layout),
Middlewares/ without Third_Party, STM32 HAL folders without the _Driver
suffix, and vendored libraries anywhere by their marker files (Mbed
TLS, lwIP, the FreeRTOS kernel, wolfSSL, FatFs) are now kept out of
SAST. A customer's own lower-case middleware/ is still scanned.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang force-pushed fix/vendor-layouts from 54f2d09d22 to 82e85e0592 2026-09-25 09:47:56 +00:00 Compare
sharang merged commit 52d3735d21 into main 2026-09-25 09:58:24 +00:00
Sign in to join this conversation.