You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(security): pin tight read bounds on JSON responses; cap actual ZIP bytes
Addresses the Copilot review on PR #2442 and the same pattern elsewhere.
- safe_extract_zip(): track the cumulative bytes actually written and fail past
max_total_bytes, so the total-size bound holds even if member headers
understate file_size (the declared-total check alone could be evaded). Mirrors
the existing per-member written guard — defense-in-depth consistency.
- Pass an explicit max_bytes to read_response_limited() at every JSON call site
instead of inheriting the 50 MiB archive/payload default:
* MAX_JSON_METADATA_BYTES (1 MiB): Azure AD token, GitHub release metadata,
and the existing latest-release fetch (migrated off an inline literal).
* MAX_JSON_CATALOG_BYTES (8 MiB): preset, extension, workflow and
integration catalog fetches.
Binary/archive downloads keep the 50 MiB ceiling.
Both ceilings are centralized as documented constants in _download_security.py.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments