Harden non-sensitive validation paths#3948
Open
mswilkison wants to merge 4 commits intomainfrom
Open
Conversation
…on tests - Document that positive firewall validation results are intentionally not cached so operator revocations take effect immediately - Clarify WithRetransmissionSupport docstring to reflect bounded-window deduplication semantics introduced by LRU eviction - Add rationale comment for maxCachedMessageIDs constant - Guard catch block error message against non-Error thrown values - Refactor cache mutex to closure+defer to release lock before delegate call - Add TestHandlerEvictsAcrossMultipleCycles to cover multiple eviction cycles and TestHandlerConcurrentAccess as a race-detector regression - Add .ubsignore for deploy script (console.log/syncFS are intentional)
piotr-roslaniec
approved these changes
May 5, 2026
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.
Summary
This PR addresses the non-sensitive hardening/correctness findings from the security review. The changes are intentionally small and localized so they can be reviewed independently from the private operational/security-exposure fixes.
Findings Addressed
Finding 4:
pkg/bitcoin/transaction_builder.gotransaction.Outputs[...]and return a descriptive error instead.Finding 5:
pkg/maintainer/spv/spv.goFinding 6:
pkg/tecdsa/retry/retry.gok.Finding 12:
solidity/ecdsa/deploy/16_initialize_allowlist_weights.tsFinding 13:
solidity/ecdsa/contracts/WalletRegistryGovernance.solfinalizeAuthorizationDecreaseDelayUpdatedestructured the authorization tuple incorrectly and wrote the wrong value back as the change period.Finding 14:
pkg/tbtc/wallet.goInputs[0].Finding 15:
pkg/firewall/firewall.goFinding 16:
pkg/net/retransmission/retransmission.goFinding 18:
scripts/initialize.sheval.Operational Impact
The firewall change intentionally removes the positive recognition cache. That means recognized, non-allowlisted peers are rechecked against the configured applications on each validation instead of being accepted from a stale positive cache entry. This trades lower stale-admission risk for additional application recognition/RPC checks on reconnects. The negative cache still rate-limits repeated misses for the same peer key, but it does not replace network-level connection controls for many distinct peer keys; operators should continue to rely on network/firewall controls and monitor RPC load.
Validation
go test ./pkg/bitcoin ./pkg/maintainer/spv ./pkg/tecdsa/retry ./pkg/tbtc ./pkg/firewall ./pkg/net/retransmissiongo test ./pkg/firewallgo test ./pkg/tbtc -run TestEnsureWalletSyncedBetweenChains_TransactionWithoutInputsbash -n scripts/initialize.shgit diff --checknpm ci --legacy-peer-depsinsolidity/ecdsanpx prettier --check contracts/WalletRegistryGovernance.sol deploy/16_initialize_allowlist_weights.ts test/WalletRegistryGovernance.test.tsnpx hardhat compileValidation Note
A focused Hardhat test run for
WalletRegistryGovernancecompiled successfully but did not reach the test cases because the localhardhat-deployfixture could not find a deployedReimbursementPoolrecord from the dependency package.Follow-up issue filed for that fixture gap: #3950