api: block submit endpoints leak raw internal Go error chains (VerifyBlockHash/HashBlock/MarshalCanonical) to clients, inconsistently (Minor)
Report
- Area: POST /blocks/* and POST /statechain/blocks
- Found: 2026-10-26, node
xe/92d83d1, repo master9787859 - Related: #77 (error shape), distinct (this is internal-symbol leakage in the error string)
Summary
When a submitted block decodes as JSON but fails structural validation, the node returns the raw, wrapped internal Go error straight to the (unauthenticated) client, exposing internal function names and the call chain. Both the ledger and the state-chain submit paths do it, and inconsistently: a type-gate failure gives a clean message, while a hashing/verify failure dumps the internal chain.
Evidence (live, 2026-10-26, https://test.network/api/v1)
POST /statechain/blocks {} -> 400 {"error":"block rejected: VerifyBlockHash: HashBlock: MarshalCanonical: prev_hash must be 32 bytes, got 0"}
POST /statechain/blocks {"prev_hash":"00"} -> 400 {"error":"block rejected: VerifyBlockHash: HashBlock: MarshalCanonical: prev_hash must be 32 bytes, got 1"}
POST /blocks/send {"type":"send","account":"00..00"}-> 400 {"error":"block rejected: verify: verify: HashBlock: MarshalBlock: previous must be 32 bytes, got 0","retryable":false}
POST /blocks/receive {} -> 400 {"error":"block type mismatch"} # clean, type gate
POST /blocks/lease {} -> 400 {"error":"block type mismatch"} # clean, type gate
Two problems are visible:
- Internal detail leak.
VerifyBlockHash,HashBlock,MarshalCanonical,MarshalBlockare internal function names and thea: b: c:chain is Go error wrapping. A client is handed the node's internal call structure instead of one actionable message. (The source is public, so this is low-secrecy, but it is still poor error hygiene and hands an attacker a free map of which internal step rejected each input.) - Inconsistency. The same class of request returns either a clean message (
block type mismatch, from the type gate) or a wrapped internal chain (from the verify/hash stage), with no stable shape a client can branch on. This compounds #77, which already notes the error contract is not what the spec declares.
Minor extra: the ledger path double-wraps, verify: verify: (case D above), which looks like a redundant wrap in the validation call path.
Impact
- Information disclosure through verbose errors (a recognised low-severity class). No fund risk.
- Clients and the SDK cannot reliably classify these errors, because the string shape depends on which internal stage failed.
Suggested fix
- At the API boundary, map internal validation/hashing errors to a small set of stable client messages (for example "invalid block: prev_hash must be 32 bytes") and log the full wrapped error server-side only.
- Remove the
verify: verify:double wrap in the ledger submit path.
Payout
XE address: 6591eab453dbd93b27e2cd674712f94b42d9e7e4d52980b966fa6da4ccd832dc
Thread
[comment from a blocked account removed]
Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is updated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0081.