test: Improve loopback address check in `rcp_bind.py`
What changed, and why it matters
This commit changes a single line in a Bitcoin Core test script. It makes the test recognize any IP address beginning with '127.' as a loopback address, instead of only '127.0.0.1'. This is a test-only fix to prevent false failures when VPNs or other software add extra loopback addresses. It does not change the Bitcoin Core software that users run, and it has no security impact.
No security action needed. This is a benign test-only improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In test/functional/rpc_bind.py, the loopback address check was relaxed from an exact string match against ‘127.0.0.1’ to a prefix check for ‘127.’. The change is confined to the test framework’s interface enumeration logic and affects only how the test selects a non-loopback IP address. No production networking, RPC, or consensus code is modified.
Changed components
test/functional/rpc_bind.pyInspect captured patch +1 / −1
diff --git a/test/functional/rpc_bind.py b/test/functional/rpc_bind.py
index 42278351..517df5d9 100755
--- a/test/functional/rpc_bind.py
+++ b/test/functional/rpc_bind.py
@@ -109,7 +109,7 @@ class RPCBindTest(BitcoinTestFramework):
raise AssertionError("all_interfaces() returned no IPv4 interfaces")
self.non_loopback_ip = None
for name,ip in interfaces:
- if ip != '127.0.0.1':
+ if not ip.startswith('127.'):
self.non_loopback_ip = ip
break
if self.non_loopback_ip is None and self.options.run_nonloopback:
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.