Skip to main content
Founding Partner + 7-Day Trial
Tier B Enterprise Fleet · 12-Language Immunity EngineAutoExtinguish: true (4-Gate Vericoding)

AutoExtinguish: true across all 12 supported languages via http.MaxBytesReader / io.LimitReader, Read::take, readNBytes, and bounded stream caps.

Commercial boundary: ciphermap immunity scan, immunity extinguish --apply, immunity attest (CycloneDX 1.6 CISA IBOM & OpenVEX 0.2.0), and ciphermap mcp require Tier B Enterprise Fleet. Offline proof and IBOM verification (--verify-proof, attest --verify) and the ciphermap demo sandbox run Free.

Back to docs
IMM-BOUND-001HIGHCISA Secure-by-Design Pledge · CWE-770 · NIST SP 800-53 Rev. 5 (SC-5, SI-16)

Unbounded Stream or Payload Allocation Across Polyglot Boundaries

Severity: HIGH

Reading an untrusted network, request, archive, or IPC stream into memory without an explicit byte ceiling allows a single oversized payload or decompression bomb to exhaust process heap memory (OOM denial-of-service). Enforce explicit byte caps across Go, TypeScript, JavaScript, Python, Java, Kotlin, C#, Rust, C/C++, Ruby, PHP, and Swift so oversized inputs fail closed before unbounded allocation.

Remediation checklist

  • Go: wrap HTTP request bodies with http.MaxBytesReader(w, r.Body, maxBytes) or wrap generic io.Reader streams with io.LimitReader(r, maxBytes+1) and reject len(data) > maxBytes.
  • TypeScript & JavaScript: enforce an explicit maxBytes accumulator guard when reading ReadableStreams, req.arrayBuffer(), or Node 'data' chunks; Python: pass an explicit byte cap to stream.read(MAX_BYTES + 1) and reject len(buf) > MAX_BYTES.
  • Java & Kotlin: use InputStream.readNBytes(MAX_BYTES + 1) instead of readAllBytes() / readBytes(); C#: enforce MaxRequestBodySize or bounded Stream/PipeReader buffers; Rust: wrap Read/AsyncRead with reader.take(MAX_BYTES + 1) before read_to_end/read_to_string.
  • C/C++: read fixed-ceiling buffers via istream::read / recv with explicit byte bounds; Ruby: call io.read(MAX_BYTES + 1) and check bytesize; PHP: pass maxlength to stream_get_contents($s, MAX_BYTES + 1) or file_get_contents('php://input', false, null, 0, MAX_BYTES + 1); Swift: use FileHandle.read(upToCount: maxBytes + 1).

Illustrative Code Examples

These fragments explain migration direction. They are not complete applications or compiler-verified patches for your project.

Vulnerable — unbounded request/stream reads (Go / Python / PHP)

terminal · zsh
// Go: unbounded io.ReadAll on attacker-controlled body
data, err := io.ReadAll(r.Body)

# Python: unbounded .read() on request stream
payload = request.stream.read()

// PHP: unbounded php://input read
$raw = file_get_contents('php://input');

Remediated — explicit byte ceilings with fail-closed rejection

terminal · zsh
// Go: 1 MiB ceiling via http.MaxBytesReader
r.Body = http.MaxBytesReader(w, r.Body, 1<<20)
data, err := io.ReadAll(r.Body)

# Python: 10 MiB ceiling + fail-closed check
payload = request.stream.read(10_485_761)
if len(payload) > 10_485_760:
    raise ValueError("payload exceeds limit")

Preview remediation proposals

Preview proposed changes free with ciphermap fix . --dry-run --offline --no-telemetry. Eligibility depends on the installed build, call shape, module format, and migration context. The bundled RSA fixture has a classical key-size candidate; that does not make it post-quantum secure. Persisted digests and unsupported contexts may be declined. Applying supported candidates requires an entitlement, explicit verifier consent, and the required project tools. Review the actual verification result before adopting a change.

View DevSecOps pricing

Other rule families