Skip to content

fix/batches: prevent command injection from repository paths - #1373

Open
cbrnrd wants to merge 3 commits into
mainfrom
carterbrainerd-vuln-140-i-can-use-a-repository-path-to-execute-trusted-helper
Open

fix/batches: prevent command injection from repository paths#1373
cbrnrd wants to merge 3 commits into
mainfrom
carterbrainerd-vuln-140-i-can-use-a-repository-path-to-execute-trusted-helper

Conversation

@cbrnrd

@cbrnrd cbrnrd commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Problem

When a volume workspace copied extra repository files, it added repository-controlled paths directly to Docker mount arguments and a shell command. A crafted directory name could change the mount configuration and run commands inside the trusted workspace helper. Those commands could read files from the machine running src.

This fixes VULN-140.

Solution

Package the extra files in a temporary tar archive. Validate that every archive path is relative and clean, mount the archive at a fixed location, and extract it with fixed tar arguments. Repository paths are now treated only as data and are not interpreted by Docker or a shell.

Verification Evidence

  • go test ./internal/batches/...
  • Added a regression test with a repository path containing shell and Docker mount syntax.
  • Ran the volume workspace helper in Docker and confirmed that it extracted the crafted path as a normal file without running it as a command.

@cbrnrd
cbrnrd marked this pull request as ready for review September 8, 2026 15:35
@cbrnrd
cbrnrd requested a review from a team September 8, 2026 15:35
@cbrnrd
cbrnrd enabled auto-merge (squash) September 9, 2026 15:18
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.

2 participants