Files
lightwalletd/frontend
DanSandClaude Opus 4.8 6f52ff0969 frontend: harden the gRPC handlers against malformed and oversized requests
Three unauthenticated issues from a security review of the published
lightwalletd, all in frontend/service.go, now fixed and validated end to end
against a regtest dragonxd backend:

- GetBlockRange and GetAddressTxids dereferenced the request's range
  (Start/End) with no nil check, so one request with an empty BlockRange
  nil-panicked and, because grpc-go v1.24.0 does not recover handler panics,
  took the whole process down. Reject a missing range with InvalidArgument
  before touching it. (Verified: an empty-range request killed the old binary;
  the fixed binary answers InvalidArgument and stays up.)
- Neither method bounded the span, so one request could walk the entire
  uncached range -- one backend RPC per height. Reject end<start and cap the
  span at maxBlockRangeSpan (10000; honest syncs are far below it). (Verified:
  a 9,000,000-block span is now refused with InvalidArgument up front.)
- GetTransaction returned Internal ("Marshal called with nil") for a missing
  transaction: strconv.ParseInt overwrote err and both branches returned a
  typed nil. Parse into a separate variable and return a real status. The
  backend reports a missing tx as -5 ("No information available about
  transaction") and a not-yet-available height as -8; map both to NotFound,
  everything else to Internal with the backend message. (Verified: a bogus
  txid returned Internal before and returns NotFound after.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-29 01:10:25 -05:00
..