{"id":"XE-0081","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"88","source_url":"https://github.com/xeprotocol/xe/issues/88","reporter_id":25,"title":"api: block submit endpoints leak raw internal Go error chains (VerifyBlockHash/HashBlock/MarshalCanonical) to clients, inconsistently (Minor)","area":"node-api","claimed_tier":"minor","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":true,"internal_ref":"","internal_url":null,"status":"accepted","closed_reason":null,"github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-10-29T13:57:23.338121+00:00","updated_at":"2026-11-10T11:38:19.284184+00:00","source_created_at":"2026-10-26T21:35:09+00:00","told_at":"2026-11-10T00:15:34+00:00","status_changed_at":"2026-10-29T14:04:12.598230+00:00","url":"https://bounty.xe.network/XE-0081","body":"- Area: POST /blocks/* and POST /statechain/blocks\n- Found: 2026-10-26, node `xe/92d83d1`, repo master `9787859`\n- Related: #77 (error shape), distinct (this is internal-symbol leakage in the error string)\n\n## Summary\n\nWhen 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.\n\n## Evidence (live, 2026-10-26, https://test.network/api/v1)\n\n```\nPOST /statechain/blocks {}                          -> 400 {\"error\":\"block rejected: VerifyBlockHash: HashBlock: MarshalCanonical: prev_hash must be 32 bytes, got 0\"}\nPOST /statechain/blocks {\"prev_hash\":\"00\"}          -> 400 {\"error\":\"block rejected: VerifyBlockHash: HashBlock: MarshalCanonical: prev_hash must be 32 bytes, got 1\"}\nPOST /blocks/send {\"type\":\"send\",\"account\":\"00..00\"}-> 400 {\"error\":\"block rejected: verify: verify: HashBlock: MarshalBlock: previous must be 32 bytes, got 0\",\"retryable\":false}\nPOST /blocks/receive {}                             -> 400 {\"error\":\"block type mismatch\"}          # clean, type gate\nPOST /blocks/lease   {}                             -> 400 {\"error\":\"block type mismatch\"}          # clean, type gate\n```\n\nTwo problems are visible:\n\n1. 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.)\n2. 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.\n\nMinor extra: the ledger path double-wraps, `verify: verify:` (case D above), which looks like a redundant wrap in the validation call path.\n\n## Impact\n\n- Information disclosure through verbose errors (a recognised low-severity class). No fund risk.\n- Clients and the SDK cannot reliably classify these errors, because the string shape depends on which internal stage failed.\n\n## Suggested fix\n\n- 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.\n- Remove the `verify: verify:` double wrap in the ledger submit path.\n\n## Payout\n\nXE address: `6591eab453dbd93b27e2cd674712f94b42d9e7e4d52980b966fa6da4ccd832dc`\n","patch_refs":[{"id":134,"repo":"xeprotocol/xe","kind":"pr","ref":"114","title":"fix(api,core): sanitize block submit error chains and remove redundant verify wrap (#88)","url":"https://github.com/xeprotocol/xe/pull/114","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-10-29T13:57:30.091343+00:00"}],"thread":[{"id":30,"source":"github","source_ref":"6463090981","author":"arturbarszcz78","team":false,"body":"[comment from a blocked account removed]","created_at":"2026-10-28T07:16:51+00:00"},{"id":1563,"source":"github","source_ref":"6755090152","author":"XE desk","team":true,"body":"Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is\nupdated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0081.","created_at":"2026-11-10T00:15:34+00:00"}]}