Makefile: allow raw amount access in fuzz tests
What changed, and why it matters
This commit changes a project Makefile so that a code-style check no longer scans files in the fuzz-testing directory. The check normally flags direct access to internal Bitcoin-amount fields (satoshis/millisatoshis) because that can lead to arithmetic overflow bugs. The change lets fuzz tests read those raw fields directly without causing a CI failure. It is a tooling/CI exemption, not a change to wallet, cryptographic, or network code, and it does not introduce a vulnerability on its own.
No immediate action required. Treat as a normal build/CI change. If reviewing, confirm that fuzz tests accessing raw amount members only do so for verification/serialization and do not perform unchecked arithmetic that the lint was designed to prevent.
Security signals we found
The commit touches a security-relevant lint rule (direct amount-field access is flagged because it risks overflow).
The change is an exclusion for fuzz tests, not a relaxation of the rule for production code.
No cryptographic, network, parsing, or wallet logic is changed in the diff.
Evidence from the diff
The check-amount-access target in the Makefile uses git grep to find direct references to .satoshis, .millisatoshis, and casts to struct amount_sat/struct amount_msat outside of the amount abstraction layer and outside of tests. The patch adds :(exclude)tests/fuzz/* to both grep invocations, exempting fuzz harnesses from this lint. The stated purpose is to allow fuzz tests to verify the raw .satoshis and .millisatoshis members. No runtime code is modified; only the CI/static-analysis rule changes scope.
Changed components
Makefilecheck-amount-access CI targettests/fuzz/* (excluded from lint)Inspect captured patch +2 / −2
diff --git a/Makefile b/Makefile
index 61c86087..9f874ea3 100644
--- a/Makefile
+++ b/Makefile
@@ -644,8 +644,8 @@ check-bad-sprintf:
# Don't access amount_msat and amount_sat members directly without a good reason
# since it risks overflow.
check-amount-access:
- @! (git grep -nE "(->|\.)(milli)?satoshis" -- "*.c" "*.h" ":(exclude)common/amount.*" ":(exclude)*/test/*" | grep -v '/* Raw:')
- @! git grep -nE "\\(struct amount_(m)?sat\\)" -- "*.c" "*.h" ":(exclude)common/amount.*" ":(exclude)*/test/*" | grep -vE "sizeof.struct amount_(m)?sat."
+ @! (git grep -nE "(->|\.)(milli)?satoshis" -- "*.c" "*.h" ":(exclude)common/amount.*" ":(exclude)*/test/*" ":(exclude)tests/fuzz/*" | grep -v '/* Raw:')
+ @! git grep -nE "\\(struct amount_(m)?sat\\)" -- "*.c" "*.h" ":(exclude)common/amount.*" ":(exclude)*/test/*" ":(exclude)tests/fuzz/*" | grep -vE "sizeof.struct amount_(m)?sat."
repeat-doc-examples:
@for i in $$(seq 1 $(n)); do \
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.