Enforce crash-safe build policy

Add compile-time checks for silent reboot, disabled core dumps, and
disabled debugger-aware panic handling. Include regression coverage,
hardening guidance, and update Phase 8/9 project status.
This commit is contained in:
2026-09-15 20:11:40 +02:00
parent f40c09c11a
commit 436c27adb1
11 changed files with 267 additions and 30 deletions
+17
View File
@@ -0,0 +1,17 @@
# Crash/debug build-policy regression
Run from the repository root:
```sh
python3 tests/security_build_policy/run.py
pio run
python3 tests/security_build_policy/run.py --sdkconfig-header .pio/build/esp32-s3-devkitc-1-n16r8/config/sdkconfig.h
```
Requires Python 3.9+ and a host C compiler (`cc`, or `CC`). If a compiler wrapper cannot write its cache in a sandbox, prefix the Python commands with `CCACHE_DISABLE=1`.
The harness compiles the actual `src/security_build_policy.c`, not a reimplementation. It checks 17 cases: safe undefined/zero disabled booleans, absent configuration, each absent/zero required setting, each forbidden setting enabled independently, and the tracked defaults. It also checks production CMake registration. The optional generated-header check adds an eighteenth case and must follow a successful firmware build; a stale header is not evidence of current firmware configuration.
Expected-invalid fixtures must fail with the policy's diagnostic. Compiler execution failures or unrelated diagnostics do not count as successful negative tests. No firmware is flashed and no secrets, partition contents or device memory are collected.
These tests do not exercise actual panic output, reboot/recovery behavior, physical debugging or log redaction. See [Phase 9 policy and target gates](../../docs/security_hardening.md).