Skip to content

fix(runner): harden runc.sh validation and args - #3592

Merged
mkoura merged 1 commit into
masterfrom
runc_validation_hardening
Aug 6, 2026
Merged

fix(runner): harden runc.sh validation and args#3592
mkoura merged 1 commit into
masterfrom
runc_validation_hardening

Conversation

@mkoura

@mkoura mkoura commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 via file(1) + dependency checks via ldd, and container-type-aware acceptance/rejection.
  • Improve CLI parsing: reject empty --opt= values, validate --extra-mount specs up front, and add an early host-arch guard for Mint containers.
  • Fix worktree .git mount 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.

Comment thread runner/runc.sh Outdated
@mkoura
mkoura force-pushed the runc_validation_hardening branch from 1d9b1cc to 33e1054 Compare August 6, 2026 10:05
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
mkoura force-pushed the runc_validation_hardening branch from 33e1054 to 1542203 Compare August 6, 2026 10:21
@mkoura
mkoura merged commit 6d92794 into master Aug 6, 2026
1 check passed
@mkoura
mkoura deleted the runc_validation_hardening branch August 6, 2026 10:24
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