fix(L1): gate console enumeration/holder-name prints behind a debug flag - #32
Open
d33mobile wants to merge 2 commits into
Open
fix(L1): gate console enumeration/holder-name prints behind a debug flag#32d33mobile wants to merge 2 commits into
d33mobile wants to merge 2 commits into
Conversation
… (off in release) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d33mobile
force-pushed
the
fix/l1-debug-prints
branch
from
August 4, 2026 17:03
3f55952 to
bb9e182
Compare
…ompiles Rebasing onto current master pulled in a latent build break: cmd_status declares `keys` inside the `if (commands_is_admin())` block but scrubs it via `secure_wipe(keys, sizeof(keys))` at function scope, so `keys` is undeclared there. asan_commands links serial/commands.c (not commands_system.c) so it never compiled this TU, but `make -C test coverage` compiles the whole first-party surface and fails here (`keys undeclared`) -- as does the real firmware build. Restore `keys` to function scope, matching the scrub's intent of always clearing the key DB from BSS (incl. the non-admin path where it stays zero-initialised). Same fix as PR hakierspejs#15 (M1). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finding (ISSUES.md L1)
On current master (
8590cdf) these prints are still ungated:main.ccore0_handle_door_verify()(the keypad-verify path) emits, per press:[door] key %u: not found/: corrupt/: disabled/: invalid code— key-id enumeration oracle[door] key %u (%s): granted— holder name + a live occupancy/attendance logstorage.cstorage_key_get()emits[storage] key %u checksum mismatch— the same per-key enumeration leak, and it fires on the door path too.Anyone inside with a USB cable can passively read who entered and when, and enumerate valid key ids — with no admin check and no
stdio_usb_connected()gate.Fix
Introduce a compile-time gate
HSLOCK_DEBUG(new headershared/debug.h, default 0):The five leaking
[door]prints and the[storage] key %u checksum mismatchprint are changed fromprintf(...)toDBG(...), so they compile to nothing in the shipped build (the default) and can be re-enabled for development with-DHSLOCK_DEBUG=1.Genuinely-operational output is deliberately kept: the one-time boot/format diagnostics in
storage.c(mount FAILED,ensure_dirs failed,init ok,format failed/ok) andmain.c's boot/wifi/NTP status lines are not per-key/per-entry and do not leak enumeration, names, or occupancy. Grant/deny signalling to the user is the buzzer (hardware), not a print.Deferred follow-up
The second bullet of L1 — an in-flash, admin-only audit ring so entries are recorded but only readable after authentication — is a larger feature and is out of scope for this PR; tracked as a follow-up.
Host tests
shared/debug.his on the host include path;storage.c(harness_storage + coverage) andmain.c(coverage) both build with the flag off (default) and on:make -C test asan→ 0make -C test valgrind→ 0make -C test coverage→ 0./ci --action=check→ 0libFuzzer
fuzz_*.charnesses untouched. Firmware (Pico) build not runnable in CI = verify-on-hw.