fix(runner): harden runc.sh validation and args - #3592
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens runner/runc.sh by tightening argument validation and making .bin/ compatibility checks more robust across container types (especially NixOS vs. bind-mounted /nix images), while improving behavior around git worktrees and container selection constraints.
Changes:
- Strengthen
.bin/validation: glob-based enumeration, clearer classification viafile(1)+ dependency checks vialdd, and container-type-aware acceptance/rejection. - Improve CLI parsing: reject empty
--opt=values, validate--extra-mountspecs up front, and add an early host-arch guard for Mint containers. - Fix worktree
.gitmount detection and emit warnings when expected gitdir/main git dir info is missing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mkoura
force-pushed
the
runc_validation_hardening
branch
from
August 6, 2026 10:05
1d9b1cc to
33e1054
Compare
Harden .bin validation in runc.sh: * Classify entries via file(1) and reject dynamically-linked binaries for NixOS containers (separate /nix store), instead of rejecting everything not verified as statically linked. * Skip entries unusable by PATH lookup (non-regular, empty, no exec bit); test mode bits, as the container runs as root. * Collect entries via nullglob/dotglob glob with an access guard instead of a pipeline whose failure was swallowed. * Capture file(1)/ldd exit status and stderr; flag unverifiable entries instead of silently passing them (LC_ALL=C for stable messages). Fix argument handling: * Validate --extra-mount specs (absolute paths, existing host path, optional mount options) before the image build. * Reject empty --opt= values; reset versions in no-value variants so earlier flags do not bleed through. * Error out early for Mint containers on non-x86_64 hosts. Also fix main .git dir detection for repos under a 'worktrees' path component, warn instead of silently skipping unusable worktree .git mounts, and refresh stale comments and help text.
mkoura
force-pushed
the
runc_validation_hardening
branch
from
August 6, 2026 10:21
33e1054 to
1542203
Compare
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.
Harden .bin validation in runc.sh:
Fix argument handling:
Also fix main .git dir detection for repos under a 'worktrees' path component, warn instead of silently skipping unusable worktree .git mounts, and refresh stale comments and help text.