🔒 Fix Command Execution Vulnerability in HTTP Requests - #328
undivisible wants to merge 1 commit into
Conversation
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_5f30783d-256c-4eb2-9cda-aa175d1acbc1) |
|
Tick the box to add this pull request to the merge queue (same as
|
🎯 What: The
curl_getandcurl_to_filefunctions inin-cli/src/package_install.rsusedCommand::new("curl")with arguments that could potentially allow command injection or arbitrary execution. They have been rewritten to use the native Rust HTTP clientureq.curlshell process, it could result in command injection, arbitrary code execution, or information disclosure. The command execution pattern is fragile and increases the surface area for attacks.🛡️ Solution: The unsafe shell invocation using
curlhas been replaced with the nativeureqHTTP client. By performing HTTP requests in-process using Rust's memory-safe ecosystem, we eliminate the need for shell spawning, mitigating command execution risks entirely while also increasing reliability. HTTP error statuses (4xx and 5xx) are explicitly verified sinceureqv3 returnsOk(Response)for them.PR created automatically by Jules for task 2916047929615634906 started by @undivisible
Note
Medium Risk
Changes how registry metadata and artifact downloads run (TLS, errors, no external curl), which affects cargo/npm/pypi/go install paths but removes shell-invocation risk.
Overview
Registry HTTP fetches no longer shell out to
curl.curl_getandcurl_to_fileinpackage_install.rsnow use an in-processureqagent (shared user agent viaget_http_agent()), while still enforcing HTTPS-only URLs.Responses with status ≥ 400 are treated as errors explicitly, since
ureqv3 can returnOkfor failed statuses. Theureqdependency is added toCargo.toml(and dev-dependencies);Cargo.lockpicks up the TLS/HTTP stack (rustls, etc.).Reviewed by Cursor Bugbot for commit f72a0f3. Configure here.