Skip to content

[Security] Harden downloadFile and downloadGitHubRelease#7795

Draft
gonzaloriestra wants to merge 1 commit into
mainfrom
security-harden-downloads-16758916623768002703
Draft

[Security] Harden downloadFile and downloadGitHubRelease#7795
gonzaloriestra wants to merge 1 commit into
mainfrom
security-harden-downloads-16758916623768002703

Conversation

@gonzaloriestra

Copy link
Copy Markdown
Contributor

This PR hardens the file download logic in the CLI.

  1. downloadFile status validation: Added a check for res.ok in the downloadFile utility. Previously, it would proceed to pipe the response body even if the request failed (e.g., 404 or 500), potentially saving an HTML error page to the target path.
  2. Streaming GitHub Release downloads: Refactored downloadGitHubRelease to use the downloadFile utility. This switches the download mechanism from response.arrayBuffer() to a streaming pipeline, which is more memory-efficient and prevents potential Denial of Service (DoS) when downloading large assets.

Tests have been updated to verify these changes.


PR created automatically by Jules for task 16758916623768002703 started by @gonzaloriestra

Hardened the `downloadFile` utility in `packages/cli-kit` to validate the HTTP response status code before processing the body. This prevents failed downloads from saving error pages as valid files.

Refactored `downloadGitHubRelease` to use `downloadFile`, enabling streaming downloads for GitHub release assets. This mitigates memory exhaustion (DoS) risks associated with downloading large releases.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant