<!-- XE-0050 · Inconsistent API response: /accounts/{address}/* lookups are case-sensitive and unvalidated · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0050>. The page is the record; this is the same page for reading.*

XE-0050 · Bounty

# Inconsistent API response: /accounts/{address}/\* lookups are case-sensitive and unvalidated

Accepted
claimed Medium
[xe#69](https://github.com/xeprotocol/xe/issues/69)
filed 2026-10-26 13:36 UTC
by cryptoloser8-coder

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Medium

Area
:   Node / API

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-10 11:38 UTC

Told
:   2026-11-10 00:15 UTC

### Patches

- [xe#141](https://github.com/xeprotocol/xe/pull/141) open by arturbarszcz78
  fix(api): normalize and validate account address in /accounts/{address}/\* (#69)

### History

- [61383](https://bounty.xe.network/log/61383) 2026-11-10 00:15 UTC reply.mirrored
- [61340](https://bounty.xe.network/log/61340) 2026-11-10 00:15 UTC reply.sent
- [17808](https://bounty.xe.network/log/17808) 2026-11-07 16:07 UTC proposal.adopted
- [17807](https://bounty.xe.network/log/17807) 2026-11-07 16:07 UTC ticket.award
- [17803](https://bounty.xe.network/log/17803) 2026-11-07 16:07 UTC proposal.rejected
- [6885](https://bounty.xe.network/log/6885) 2026-11-05 13:45 UTC proposal.created
- [1810](https://bounty.xe.network/log/1810) 2026-11-02 19:16 UTC proposal.created
- [1464](https://bounty.xe.network/log/1464) 2026-11-02 10:11 UTC note.added
- [728](https://bounty.xe.network/log/728) 2026-10-29 14:22 UTC note.added
- [727](https://bounty.xe.network/log/727) 2026-10-29 14:22 UTC ticket.facts area
- [621](https://bounty.xe.network/log/621) 2026-10-29 14:05 UTC github.labels
- [371](https://bounty.xe.network/log/371) 2026-10-29 14:04 UTC ticket.status triaging → accepted

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

### Report

**Suggested tier:** Medium (inconsistent API responses / missing checks). I may be over-rating it — it is read-only with no funds at risk, so Minor would also be fair. Deferring to the core team.

**Component:** HTTP API — `/accounts/{address}/*` read endpoints.
**Network:** testnet-0005, reproduced against `https://ffm.core.test.network`, 2026-10-26.

## Summary

Account addresses are 32-byte values rendered as hex, and hex is case-insensitive (`A2…` and `a2…` are the same bytes / the same account). The ledger stores addresses lowercased, but the balance lookup does not normalize the query, so the **same account** returns its real balance in lowercase and an **empty** result in uppercase. The endpoints also do not validate the address format at all (non-hex and arbitrarily long strings return `200` with empty data instead of `400`).

## Steps to reproduce

Take any funded account from the public `/blocks/recent` feed, then query it in both cases:

```
# lowercase (canonical)
curl -s https://ffm.core.test.network/accounts/a2673b1cb92518fbcd2c578ef297ce79e90bd1e6e0fca13a50af1485b86f435d/balance
{"address":"a2673b1cb92518fbcd2c578ef297ce79e90bd1e6e0fca13a50af1485b86f435d","balances":{"XE":147898100},"spendable":{"XE":0},"final_height":182}

# UPPERCASE (same 32 bytes, valid hex)
curl -s https://ffm.core.test.network/accounts/A2673B1CB92518FBCD2C578EF297CE79E90BD1E6E0FCA13A50AF1485B86F435D/balance
{"address":"A2673B1CB92518FBCD2C578EF297CE79E90BD1E6E0FCA13A50AF1485B86F435D","balances":{},"spendable":{},"final_height":0}
```

Same account, two valid encodings, different answers (real balance vs empty).

Related — no format validation (both return `200` with empty balances instead of `400`):

```
curl -s https://ffm.core.test.network/accounts/gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg/balance   # non-hex
curl -s "https://ffm.core.test.network/accounts/$(python3 -c 'print("f"*4000)')/balance"                                      # 4000 chars
```

## Root cause

- `api/handler.go` `handleGetBalance` (and the sibling `/chain`, `/keyset`, `/reputation` handlers) use `r.PathValue("address")` with only a non-empty check, then look it up directly.
- `core/ledger.go` `GetAssetBalances` does a raw map lookup `l.assetBalances[account]` with no case normalization.
- Blocks are stored lowercased via `normalizeBlockHex` (`core/ledger.go:711`), so the map keys are lowercase; an uppercase query misses.

## Impact

Read-only. No funds at risk, no state change, no crash, no auth bypass. The concrete harm is a correctness/consistency bug: a client, SDK or explorer that passes a validly-encoded uppercase address is told the account is empty (balance 0, final\_height 0), which could mislead balance checks. The missing format validation is a hardening gap (unvalidated input echoed with 200).

## Suggested fix

Normalize the address (`strings.ToLower`) and validate it (exactly 64 hex chars) in the account handlers or a shared middleware; return `400` otherwise.

## Reward address

618d0f48a31ab36aaa8eb30d7c757c242b9a08fad7c602ed638f81537ce0d4f8

### Thread

**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-0050.
