mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-04 06:12:07 +01:00
Merge bitcoin/bitcoin#30482: rest: Reject truncated hex txid early in getutxos parsing
fac0c3d4bfdoc: Add release notes for two pull requests (MarcoFalke)fa7b57e5f5refactor: Replace ParseHashStr with FromHex (MarcoFalke)fa90777245rest: Reject truncated hex txid early in getutxos parsing (MarcoFalke)fab6ddbee6refactor: Expose FromHex in transaction_identifier (MarcoFalke)fad2991ba0refactor: Implement strict uint256::FromHex() (MarcoFalke)fa103db2bbscripted-diff: Rename SetHex to SetHexDeprecated (MarcoFalke)fafe4b8051test: refactor: Replace SetHex with uint256 constructor directly (MarcoFalke) Pull request description: In `rest_getutxos` truncated txids such as `aa` or `ff` are accepted. This is brittle at best. Fix it by rejecting any truncated (or overlarge) input. ---- Review note: This also starts a major refactor to rework hex parsing in Bitcoin Core, meaning that a few refactor commits are included as well. They are explained individually in the commit message and the work will be continued in the future. ACKs for top commit: stickies-v: re-ACKfac0c3d4bf- only doc and test updates to address review comments, thanks! hodlinator: ACKfac0c3d4bfTree-SHA512: 473feb3fcf6118443435d1dd321006135b0b54689bfbbcb1697bb5811a449bef51f475c715de6911ff3c4ea3bdb75f601861ff93347bc4414d6b9e5298105dd7
This commit is contained in:
@@ -208,6 +208,8 @@ class RESTTest (BitcoinTestFramework):
|
||||
self.test_rest_request(f"/getutxos/{spending[0]}_+1", ret_type=RetType.OBJ, status=400)
|
||||
self.test_rest_request(f"/getutxos/{spending[0]}-+1", ret_type=RetType.OBJ, status=400)
|
||||
self.test_rest_request(f"/getutxos/{spending[0]}--1", ret_type=RetType.OBJ, status=400)
|
||||
self.test_rest_request(f"/getutxos/{spending[0]}aa-1234", ret_type=RetType.OBJ, status=400)
|
||||
self.test_rest_request(f"/getutxos/aa-1234", ret_type=RetType.OBJ, status=400)
|
||||
|
||||
# Test limits
|
||||
long_uri = '/'.join([f"{txid}-{n_}" for n_ in range(20)])
|
||||
|
||||
Reference in New Issue
Block a user