global: replace randombytes_buf() with randbytes() wrapper.
What changed, and why it matters
This commit only adds a new header include (<common/randbytes.h>) to 24 test files. It does not change any production code, cryptographic operations, or runtime behavior. The change is a test-infrastructure refactor to support deterministic randomness in tests, not a security fix or vulnerability.
No security action required. Treat as routine test refactoring. If reviewing the broader series, verify that the randbytes() wrapper correctly delegates to a cryptographically secure source in production builds and only allows deterministic overrides in test contexts.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds #include
Changed components
common/test/run-bigsize.ccommon/test/run-blindedpath_enctlv.ccommon/test/run-bolt11.ccommon/test/run-bolt12-encode-test.ccommon/test/run-bolt12-format-string-test.ccommon/test/run-bolt12-offer-decode.ccommon/test/run-bolt12_decode.ccommon/test/run-bolt12_merkle-json.ccommon/test/run-bolt12_merkle.ccommon/test/run-bolt12_period.ccommon/test/run-channel_type.ccommon/test/run-codex32.ccommon/test/run-coin_mvt.ccommon/test/run-cryptomsg.ccommon/test/run-json_filter.ccommon/test/run-json_remove.ccommon/test/run-json_scan.ccommon/test/run-json_stream-filter.ccommon/test/run-lease_rates.ccommon/test/run-psbt_diff.ccommon/test/run-route_blinding_test.ccommon/test/run-splice_script.ccommon/test/run-tlv_span.ccommon/test/run-tlv_unknown.cInspect captured patch +24 / −0
diff --git a/common/test/run-bigsize.c b/common/test/run-bigsize.c
index 6ee860a..57c6dbe 100644
--- a/common/test/run-bigsize.c
+++ b/common/test/run-bigsize.c
@@ -4,6 +4,7 @@
#include <common/amount.h>
#include <common/json_parse.c>
#include <common/json_parse_simple.c>
+#include <common/randbytes.h>
#include <common/setup.h>
static const char *reason;
diff --git a/common/test/run-blindedpath_enctlv.c b/common/test/run-blindedpath_enctlv.c
index cc67bb2..46f940b 100644
--- a/common/test/run-blindedpath_enctlv.c
+++ b/common/test/run-blindedpath_enctlv.c
@@ -3,6 +3,7 @@
#include "../blinding.c"
#include "../hmac.c"
#include <common/channel_id.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
diff --git a/common/test/run-bolt11.c b/common/test/run-bolt11.c
index a3c4c3a..1fbc3ce 100644
--- a/common/test/run-bolt11.c
+++ b/common/test/run-bolt11.c
@@ -10,6 +10,7 @@
#include "../wire/fromwire.c"
#include "../wire/towire.c"
#include <ccan/err/err.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
diff --git a/common/test/run-bolt12-encode-test.c b/common/test/run-bolt12-encode-test.c
index aff4196..60fab44 100644
--- a/common/test/run-bolt12-encode-test.c
+++ b/common/test/run-bolt12-encode-test.c
@@ -12,6 +12,7 @@
#include <common/bolt12.c>
#include <common/bolt12_merkle.h>
#include <common/features.c>
+#include <common/randbytes.h>
#include <common/sciddir_or_pubkey.c>
#include <common/setup.h>
#include <inttypes.h>
diff --git a/common/test/run-bolt12-format-string-test.c b/common/test/run-bolt12-format-string-test.c
index 10f6748..0af6d90 100644
--- a/common/test/run-bolt12-format-string-test.c
+++ b/common/test/run-bolt12-format-string-test.c
@@ -8,6 +8,7 @@
#include <common/bolt12.h>
#include <common/bolt12_merkle.h>
#include <common/features.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <common/utils.h>
diff --git a/common/test/run-bolt12-offer-decode.c b/common/test/run-bolt12-offer-decode.c
index 059b2a8..ad82999 100644
--- a/common/test/run-bolt12-offer-decode.c
+++ b/common/test/run-bolt12-offer-decode.c
@@ -14,6 +14,7 @@
#include <ccan/array_size/array_size.h>
#include <ccan/tal/grab_file/grab_file.h>
#include <ccan/tal/path/path.h>
+#include <common/randbytes.h>
#include <common/setup.h>
/* AUTOGENERATED MOCKS START */
diff --git a/common/test/run-bolt12_decode.c b/common/test/run-bolt12_decode.c
index 718f2a9..c7c5fcf 100644
--- a/common/test/run-bolt12_decode.c
+++ b/common/test/run-bolt12_decode.c
@@ -8,6 +8,7 @@
#include <ccan/json_escape/json_escape.h>
#include <ccan/tal/grab_file/grab_file.h>
#include <ccan/tal/path/path.h>
+#include <common/randbytes.h>
#include <common/setup.h>
/* AUTOGENERATED MOCKS START */
diff --git a/common/test/run-bolt12_merkle-json.c b/common/test/run-bolt12_merkle-json.c
index b414fe7..d585521 100644
--- a/common/test/run-bolt12_merkle-json.c
+++ b/common/test/run-bolt12_merkle-json.c
@@ -12,6 +12,7 @@
#include <ccan/tal/grab_file/grab_file.h>
#include <ccan/tal/path/path.h>
#include <common/channel_type.h>
+#include <common/randbytes.h>
#include <common/setup.h>
/* AUTOGENERATED MOCKS START */
diff --git a/common/test/run-bolt12_merkle.c b/common/test/run-bolt12_merkle.c
index 59ab359..4ea5151 100644
--- a/common/test/run-bolt12_merkle.c
+++ b/common/test/run-bolt12_merkle.c
@@ -7,6 +7,7 @@
#include <ccan/array_size/array_size.h>
#include <common/channel_type.h>
#include <common/features.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <secp256k1_schnorrsig.h>
diff --git a/common/test/run-bolt12_period.c b/common/test/run-bolt12_period.c
index 4152f13..28dd706 100644
--- a/common/test/run-bolt12_period.c
+++ b/common/test/run-bolt12_period.c
@@ -5,6 +5,7 @@
#include <ccan/array_size/array_size.h>
#include <ccan/tal/grab_file/grab_file.h>
#include <ccan/tal/path/path.h>
+#include <common/randbytes.h>
#include <common/setup.h>
/* AUTOGENERATED MOCKS START */
diff --git a/common/test/run-channel_type.c b/common/test/run-channel_type.c
index 495f695..196c9d3 100644
--- a/common/test/run-channel_type.c
+++ b/common/test/run-channel_type.c
@@ -2,6 +2,7 @@
#include "../channel_type.c"
#include "../features.c"
#include <ccan/tal/str/str.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
#include <lightningd/channel_state.h>
diff --git a/common/test/run-codex32.c b/common/test/run-codex32.c
index 79aafbf..aa41781 100644
--- a/common/test/run-codex32.c
+++ b/common/test/run-codex32.c
@@ -8,6 +8,7 @@
#include <common/codex32.h>
#include <ccan/tal/grab_file/grab_file.h>
#include <ccan/tal/path/path.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <wire/wire.h>
diff --git a/common/test/run-coin_mvt.c b/common/test/run-coin_mvt.c
index b499bdf..e714b61 100644
--- a/common/test/run-coin_mvt.c
+++ b/common/test/run-coin_mvt.c
@@ -1,6 +1,7 @@
#include "config.h"
#include "../coin_mvt.c"
#include <ccan/tal/str/str.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
diff --git a/common/test/run-cryptomsg.c b/common/test/run-cryptomsg.c
index 3c1c77d..f23eb5a 100644
--- a/common/test/run-cryptomsg.c
+++ b/common/test/run-cryptomsg.c
@@ -1,5 +1,6 @@
#include "config.h"
#include <ccan/str/hex/hex.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <common/status.h>
#include <common/utils.h>
diff --git a/common/test/run-json_filter.c b/common/test/run-json_filter.c
index 015ff35..8113619 100644
--- a/common/test/run-json_filter.c
+++ b/common/test/run-json_filter.c
@@ -6,6 +6,7 @@
#include "../json_stream.c"
#include <ccan/json_out/json_out.h>
#include <common/json_command.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
diff --git a/common/test/run-json_remove.c b/common/test/run-json_remove.c
index 880e9f8..d6c9db5 100644
--- a/common/test/run-json_remove.c
+++ b/common/test/run-json_remove.c
@@ -2,6 +2,7 @@
#include <common/amount.h>
#include <common/json_param.c>
#include <common/json_parse_simple.c>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
#include <wire/wire.h>
diff --git a/common/test/run-json_scan.c b/common/test/run-json_scan.c
index 6519129..29f0830 100644
--- a/common/test/run-json_scan.c
+++ b/common/test/run-json_scan.c
@@ -2,6 +2,7 @@
#include "../json_parse.c"
#include "../json_parse_simple.c"
#include <common/amount.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
#include <wire/wire.h>
diff --git a/common/test/run-json_stream-filter.c b/common/test/run-json_stream-filter.c
index 3f40141..adda254 100644
--- a/common/test/run-json_stream-filter.c
+++ b/common/test/run-json_stream-filter.c
@@ -4,6 +4,7 @@
#include <assert.h>
#include <ccan/tal/str/str.h>
#include <common/channel_type.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <inttypes.h>
#include <stdio.h>
diff --git a/common/test/run-lease_rates.c b/common/test/run-lease_rates.c
index 5bf13c6..3e9cd14 100644
--- a/common/test/run-lease_rates.c
+++ b/common/test/run-lease_rates.c
@@ -1,6 +1,7 @@
#include "config.h"
#include "../amount.c"
#include "../lease_rates.c"
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
diff --git a/common/test/run-psbt_diff.c b/common/test/run-psbt_diff.c
index bb18358..9d42a4b 100644
--- a/common/test/run-psbt_diff.c
+++ b/common/test/run-psbt_diff.c
@@ -1,4 +1,5 @@
#include "config.h"
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
#include "../amount.c"
diff --git a/common/test/run-route_blinding_test.c b/common/test/run-route_blinding_test.c
index 27c740a..604829a 100644
--- a/common/test/run-route_blinding_test.c
+++ b/common/test/run-route_blinding_test.c
@@ -13,6 +13,7 @@
#include <common/clock_time.h>
#include <common/json_parse.h>
#include <common/json_stream.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <common/wireaddr.h>
#include <stdio.h>
diff --git a/common/test/run-splice_script.c b/common/test/run-splice_script.c
index 58157e0..82b4d2f 100644
--- a/common/test/run-splice_script.c
+++ b/common/test/run-splice_script.c
@@ -6,6 +6,7 @@
#include "../json_stream.c"
#include "../json_parse_simple.c"
#include <bitcoin/chainparams.h>
+#include <common/randbytes.h>
#include <common/setup.h>
#include <common/splice_script.h>
#include <assert.h>
diff --git a/common/test/run-tlv_span.c b/common/test/run-tlv_span.c
index 8a6156e..8d5e22d 100644
--- a/common/test/run-tlv_span.c
+++ b/common/test/run-tlv_span.c
@@ -2,6 +2,7 @@
#include "../bolt12.c"
#include "../bigsize.c"
#include "../../wire/fromwire.c"
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
diff --git a/common/test/run-tlv_unknown.c b/common/test/run-tlv_unknown.c
index 966f53b..7a18c56 100644
--- a/common/test/run-tlv_unknown.c
+++ b/common/test/run-tlv_unknown.c
@@ -5,6 +5,7 @@
#include "../../wire/towire.c"
#include "../bigsize.c"
#include "../bolt12.c"
+#include <common/randbytes.h>
#include <common/setup.h>
#include <stdio.h>
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.