[SECURITY] MEDIUM: No response size limits - potential memory exhaustion #8

Closed
opened 2026-03-25 10:39:13 +01:00 by shoko · 0 comments
Owner

Severity: MEDIUM

The code loads the entire API response into memory via json.loads() without any size limits. If a malicious or compromised Polymarket API returned an extremely large JSON payload (gigabytes), the script could exhaust system memory.

Location

scripts/browse.py lines 53, 79-81, 357-358, 393-403

Add response size limits:

MAX_RESPONSE_SIZE = 10 * 1024 * 1024  # 10MB
if len(r.stdout) > MAX_RESPONSE_SIZE:
    raise ValueError(f"API response too large: {len(r.stdout)} bytes")

Reference

See reviews/2026-03-25.md Section 6.6

## Severity: MEDIUM The code loads the entire API response into memory via `json.loads()` without any size limits. If a malicious or compromised Polymarket API returned an extremely large JSON payload (gigabytes), the script could exhaust system memory. ## Location `scripts/browse.py` lines 53, 79-81, 357-358, 393-403 ## Recommended Fix Add response size limits: ```python MAX_RESPONSE_SIZE = 10 * 1024 * 1024 # 10MB if len(r.stdout) > MAX_RESPONSE_SIZE: raise ValueError(f"API response too large: {len(r.stdout)} bytes") ``` ## Reference See `reviews/2026-03-25.md` Section 6.6
shoko added the mediumsecurity labels 2026-03-25 10:39:13 +01:00
shoko closed this issue 2026-03-27 04:10:04 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/jujutsu-skills#8