<!-- XE-0081 · api: block submit endpoints leak raw internal Go error chains (VerifyBlockHash/HashBlock/MarshalCanonical) to clients, inconsistently (Minor) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0081>. The page is the record; this is the same page for reading.*

XE-0081 · Bounty

# api: block submit endpoints leak raw internal Go error chains (VerifyBlockHash/HashBlock/MarshalCanonical) to clients, inconsistently (Minor)

Accepted
claimed Minor
[xe#88](https://github.com/xeprotocol/xe/issues/88)
filed 2026-10-26 21:35 UTC
by BoomGone

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Minor

Area
:   Node / API

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-10 11:38 UTC

Told
:   2026-11-10 00:15 UTC

### Patches

- [xe#114](https://github.com/xeprotocol/xe/pull/114) open by arturbarszcz78
  fix(api,core): sanitize block submit error chains and remove redundant verify wrap (#88)

### History

- [61386](https://bounty.xe.network/log/61386) 2026-11-10 00:15 UTC reply.mirrored
- [61343](https://bounty.xe.network/log/61343) 2026-11-10 00:15 UTC reply.sent
- [18231](https://bounty.xe.network/log/18231) 2026-11-07 16:10 UTC proposal.adopted
- [18230](https://bounty.xe.network/log/18230) 2026-11-07 16:10 UTC ticket.award
- [18229](https://bounty.xe.network/log/18229) 2026-11-07 16:10 UTC proposal.rejected
- [6905](https://bounty.xe.network/log/6905) 2026-11-05 13:45 UTC proposal.created
- [1835](https://bounty.xe.network/log/1835) 2026-11-02 19:16 UTC proposal.created
- [1485](https://bounty.xe.network/log/1485) 2026-11-02 10:11 UTC note.added
- [732](https://bounty.xe.network/log/732) 2026-10-29 14:22 UTC note.added
- [731](https://bounty.xe.network/log/731) 2026-10-29 14:22 UTC ticket.facts area, claimed\_tier
- [624](https://bounty.xe.network/log/624) 2026-10-29 14:05 UTC github.labels
- [387](https://bounty.xe.network/log/387) 2026-10-29 14:04 UTC ticket.status triaging → accepted

[Full history](https://bounty.xe.network/log?ref=XE-0081) · [JSON](https://bounty.xe.network/v1/tickets/XE-0081) · [markdown](https://bounty.xe.network/XE-0081.md)

### Report

- Area: POST /blocks/\* and POST /statechain/blocks
- Found: 2026-10-26, node `xe/92d83d1`, repo master `9787859`
- 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:

1. Internal detail leak. `VerifyBlockHash`, `HashBlock`, `MarshalCanonical`, `MarshalBlock` are internal function names and the `a: 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.)
2. 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

**arturbarszcz78**2026-10-28 07:16 UTCgithub

\[comment from a blocked account removed\]

**XE desk**team2026-11-10 00:15 UTCgithub

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.
