mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 16:02:38 +00:00
rpc: fix OpenRPC hex pattern to allow empty strings #36462
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36462
Loading…
Reference in a new issue
No description provided.
Delete branch "openrpc-hex-pattern"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The OpenRPC schema from
getopenrpcinfodeclares everySTR_HEXvalue with the pattern^[0-9a-fA-F]+$. That pattern rejects the empty string, but the node both returns and accepts empty hex. For example:scriptSig.hexis""for native segwit input (decoderawtransaction,getrawtransaction, etc)decodescript ""succeedsSo a client that validates traffic against the schema rejects valid requests and responses.
This changes the pattern to
^([0-9a-fA-F]{2})*$(zero or more hex-encoded bytes)The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Base:
db0bde16b910f43e37252d4172d97f01653ae0f1Head:
4d7e00d36bf0d287dc241c3aae3852f3d799ed08Findings
Suggestions
Also assert the STR_HEX result schema (test/functional/rpc_openrpc.py:81, head)
This assertion covers the argument-side STR_HEX schema for
createrawtransaction.outputs.data, but the PR changesOpenRPCResultSchemaindependently. The test does not cover a STR_HEX result such asgetrawtransaction'svin[].scriptSig.hex, so a regression that rejects empty response values could go unnoticed. Add an assertion for a STR_HEX result pattern, ideally verifying that it admits"".Review coverage was incomplete. adversarial: The added even-length restriction remains unverified against all valid STR_HEX traffic. In particular, the definitions of src/rpc/util.cpp::ParseHashV/ParseHexV and numeric-hex result producers such as versionHex and bits were not inspected; their contracts could establish or disprove a schema compatibility regression.
Full review report
lgtm ACK
4d7e00d36bACK
4d7e00d36bACK
4d7e00d36bIn theory, one could have size set (in the docs and the schema), if the size is hard and known, but this is probably a massively larger change.
Backported to
32.xin #36427.