Repository navigation
[WEB-10188] fix: cap outbound fetch response sizes - #10317
Conversation
The work item link crawl (page title and favicon) and webhook delivery now stream the response and stop at a byte cap and a time limit instead of reading the whole body. An oversized favicon falls back to the default icon, and the webhook log keeps only the start of the response body.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
sriramveeraghanta
left a comment
There was a problem hiding this comment.
LGTM. Non-blocking: the time limit is only checked between chunks, and TestReadCappedBody patches time.monotonic for the whole process.
The work item link crawl (page title and favicon) and webhook delivery now stream the response and stop at a byte cap and a time limit instead of reading the whole body. An oversized favicon falls back to the default icon, and the webhook log keeps only the start of the response body.
The work item link crawl (page title and favicon) and webhook delivery now stream the response and stop at a byte cap and a time limit instead of reading the whole body. An oversized favicon falls back to the default icon, and the webhook log keeps only the start of the response body. (cherry picked from commit 99a6f23)
Description
Three outbound fetches read the whole response body with no size limit: the page-title fetch and the favicon fetch for work item links, and webhook delivery (whose response body is stored in the webhook log). The remote server therefore decided how much memory a Celery worker used and how much was stored.
read_capped_bodynext to the pinned-fetch helpers: streams the response, stops at a byte cap or a time limit, and always closes it.SSRF validation is unchanged.
Behavior change:
Limits of this change: the time limit is checked between chunks, so a server that trickles bytes can still hold a read for a while, and the header phase is not covered. A hard bound needs Celery task time limits, which this codebase does not set.
WebhookLog.response_headersis still stored whole.Type of Change
Screenshots and Media (if applicable)
Test Scenarios
plane/tests/unit/bg_tasks/test_outbound_response_caps.pywith the fetch mocked: an oversized page is not read in full, an oversized favicon is not stored, the webhook response is streamed and truncated, and normal responses behave as before. 6 passed; the oversized cases fail without the fix.References
Created with Claude Code