Fix critical security issues: checksum bypass, command injection, HTTPS enforcement#1
Merged
Merged
Conversation
…eval - Verify Go module h1: checksums against actual archive SHA-256 instead of accepting any string starting with 'h1:' (checksum bypass) - Enforce HTTPS for all registry fetch URLs (curl_get, curl_to_file) - Restrict run_invoke to an allowlist of known programs to prevent arbitrary command execution from package metadata - Use per-invocation temp directories in cmd_eval to prevent symlink attacks on the shared predictable inaug-eval path - Pass URL as a positional arg to bash in cmd_update_remote instead of interpolating into a shell string Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
cargo fmt --check was already failing on master; this commit applies rustfmt to all affected files so CI passes. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Replace or_else(|| match ...) with or(match ...) for unnecessary lazy evaluation, and collapse nested if into if-let chain. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes five security issues found during a codebase audit:
Critical — Go module checksum bypass (
package_install.rs):verify_archive_checksumforGoModuleSumonly checkedexpected.starts_with("h1:")— any string starting withh1:passed verification regardless of archive content. Now actually computesSHA-256(archive)and compares the base64 encoding against theh1:payload.Critical — Arbitrary command execution via package metadata (
package_runtime.rs):run_invokeexecuted whateverspec.programwas specified ininauguration.package.jsonmetadata with no restrictions. A malicious package could setprogram: "rm"or any other binary. AddedALLOWED_INVOKE_PROGRAMSallowlist (echo,node,python3,cargo,go,true).High — HTTPS enforcement for registry fetches (
package_install.rs):curl_getandcurl_to_fileaccepted arbitrary URLs from registry JSON responses (e.g. npm tarball URLs). Addedrequire_https()gate to reject non-HTTPS URLs before fetching.High — Predictable temp dir in
cmd_eval(main.rs):cmd_evalused a shared, predictable/tmp/inaug-eval/directory — vulnerable to symlink races. Now creates a per-invocation directory with PID and nanosecond timestamp:inaug-eval-{pid}-{nanos}, and cleans up the entire directory after use.Medium — Shell injection surface in
cmd_update_remote(main.rs):The install URL was interpolated directly into a
bash -cstring. Now passes the URL as$1viabash -c '...' -- <url>positional argument pattern.Link to Devin session: https://app.devin.ai/sessions/749ee7d341a04725be6d3f500439a8d1
Requested by: @undivisible