Full-codebase-audit 2026-05-30 outputs: - Audit report: 09 - Audits/Full Codebase Audit - 2026-05-30.md - 81 issue files ISSUE-055..135 (decisions + 1 skipped no-brainer). - Scanner docs from scratch (was zero): architecture, data model, API ref, payment flow, operations runbook + repo README. - Doc-sync updates across API reference, data models, flows, design system. - Secret Rotation Runbook (08 - Operations) for the exposed credentials. - Reusable workflow guide (07 - Development) + .claude/workflows/full-codebase-audit.js. Issues remain status:open intentionally — the code fixes are uncommitted-then-committed working-tree changes per repo and aren't "resolved" until merged/deployed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
41 lines
1.4 KiB
Markdown
41 lines
1.4 KiB
Markdown
---
|
|
issue: 113
|
|
title: "Scanner/backend: RPC response bodies read without size limit — OOM risk"
|
|
severity: medium
|
|
domain: Scanner
|
|
labels: [security, scanner, oom]
|
|
status: open
|
|
created: 2026-05-30
|
|
source: Full Codebase Audit 2026-05-30
|
|
---
|
|
|
|
# Scanner/backend: RPC response bodies read without size limit — OOM risk
|
|
|
|
**Severity:** medium
|
|
**Domain:** Scanner
|
|
**Labels:** security, scanner, oom
|
|
|
|
## Description
|
|
|
|
NB-42 applied a `LimitReader` as a mechanical guard with a default cap, but the exact byte limit per endpoint was not decided. Choosing the wrong cap (too small) breaks legitimate large responses; too large offers little protection. A malicious RPC node can still exhaust memory if the cap is too generous.
|
|
|
|
## Options
|
|
|
|
1. Wrap `resp.Body` in `io.LimitReader(resp.Body, maxBytes)` with a generous per-endpoint cap (applied as NB-42).
|
|
2. Use `http.MaxBytesReader`-style enforcement and error on exceed.
|
|
3. Stream-parse JSON with a bounded decoder.
|
|
|
|
## Recommendation
|
|
|
|
Review the default cap applied by NB-42 against actual maximum RPC response sizes for each chain (EVM batch, Tron page, TON jetton response). Adjust per-endpoint caps and error explicitly when the limit is exceeded rather than silently truncating.
|
|
|
|
## Affected Files
|
|
|
|
- `scanner/chain.go:96`
|
|
- `scanner/tron_chain.go:116`
|
|
- `scanner/ton_chain.go:106`
|
|
|
|
## References
|
|
|
|
- [Full Codebase Audit 2026-05-30](../09%20-%20Audits/Full%20Codebase%20Audit%20-%202026-05-30.md) — DEC-72
|