Skip to content

Fix critical security issues: checksum bypass, command injection, HTTPS enforcement#1

Merged
undivisible merged 3 commits into
masterfrom
devin/1782092786-security-fixes
Jun 22, 2026
Merged

Fix critical security issues: checksum bypass, command injection, HTTPS enforcement#1
undivisible merged 3 commits into
masterfrom
devin/1782092786-security-fixes

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Fixes five security issues found during a codebase audit:

Critical — Go module checksum bypass (package_install.rs):
verify_archive_checksum for GoModuleSum only checked expected.starts_with("h1:") — any string starting with h1: passed verification regardless of archive content. Now actually computes SHA-256(archive) and compares the base64 encoding against the h1: payload.

Critical — Arbitrary command execution via package metadata (package_runtime.rs):
run_invoke executed whatever spec.program was specified in inauguration.package.json metadata with no restrictions. A malicious package could set program: "rm" or any other binary. Added ALLOWED_INVOKE_PROGRAMS allowlist (echo, node, python3, cargo, go, true).

High — HTTPS enforcement for registry fetches (package_install.rs):
curl_get and curl_to_file accepted arbitrary URLs from registry JSON responses (e.g. npm tarball URLs). Added require_https() gate to reject non-HTTPS URLs before fetching.

High — Predictable temp dir in cmd_eval (main.rs):
cmd_eval used 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 -c string. Now passes the URL as $1 via bash -c '...' -- <url> positional argument pattern.

Link to Devin session: https://app.devin.ai/sessions/749ee7d341a04725be6d3f500439a8d1
Requested by: @undivisible

…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>
@undivisible undivisible self-assigned this Jun 22, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

undivisible and others added 2 commits June 22, 2026 01:52
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>
@undivisible undivisible merged commit 05c843a into master Jun 22, 2026
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant