Skip to content

fix(sandbox): allow identity-preserving setresuid and setresgid calls - #4104

Open
drew wants to merge 2 commits into
mainfrom
codex/fix/4102-make-identity/drew
Open

drew wants to merge 2 commits into
mainfrom
codex/fix/4102-make-identity/drew

Conversation

@drew

@drew drew commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

GNU Make cannot launch recipes because the sandbox denies identity-preserving setresuid and setresgid calls. Allow each argument to be the established workload UID/GID or -1, while keeping identity changes and supplementary-group changes denied.

Related Issue

Closes #4102

Changes

  • Capture UID/GID before fork and reject filter preparation if real, effective, and saved IDs differ.
  • Check all three arguments of setresuid and setresgid in the sandbox child filter. Other credential setters remain blocked.
  • Add kernel tests for every unchanged-ID combination and denied changes in each slot.
  • Add a Docker/Podman Make fixture with distinct non-root UID/GID values. Cover direct recipes, shell recipes, $(shell ...), and posix_spawn(resetids=True) at startup and through piped and terminal exec.
  • Document the identity-preserving exception in the security guidance.

Release Notes

GNU Make recipes can run as the sandbox's non-root user without a custom runtime or Make upgrade.

Testing

  • Scoped format, lint, and build checks pass.
    • Sandbox library: 327 tests passed.
    • The identity regression also passed as root in a disposable Docker container, where the kernel would otherwise permit identity changes.
    • Sandbox all-target Clippy and the Make E2E target's Clippy passed with warnings denied.
    • Rust formatting, Markdown lint, and diff checks passed.
    • Fern documentation validation passed with zero errors and three warnings; navigation checks passed.
    • Built the portable musl sandbox runtime and packaged it with mise run build:docker:sandbox.
  • Unit tests added.
  • E2E test added and run locally on Linux x86_64 with Docker.
    • A/B comparison using unchanged gateway/CLI/supervisor: the unpatched runtime fails with Make's Operation not permitted / Error 127; the patched runtime passes.
    • The patched runtime also passes with the gateway and CLI built from the branch containing current main (2e5589b21).
    • Startup, piped exec, and terminal exec pass with UID 10001 and GID 10002.
    • The fixture supports Podman; Podman was not run locally in this update.

Checklist

  • Follows Conventional Commits.
  • Commits are signed off for DCO.
  • Published security documentation updated.

Signed-off-by: Drew Newberry <anewberry@nvidia.com>
@drew
drew requested review from a team, derekwaynecarr, mrunalp and sjenning as code owners October 2, 2026 04:39
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

This pull request has had no activity for 14 days and is now marked stale.

@github-actions github-actions Bot added the state:stale Inactive item at risk of automatic closure. label Oct 16, 2026
@tarabishy2020

tarabishy2020 commented Oct 26, 2026 •

Copy link
Copy Markdown

@drew X servers hit the same denial through the single-argument calls: xserver's Popen runs setgid(getgid()) and setuid(getuid()) in the child before running xkbcomp. Under 0.1.* both return EPERM, so the keymap never compiles and Xvfb exits with "Failed to activate virtual core keyboard". Reproduced on 0.1.5 with the VM driver (macOS arm64). The filter though doesn't depend on the driver. Would it be possible for this PR to also allow setuid/setgid when the argument equals the workload uid/gid?

@github-actions github-actions Bot removed the state:stale Inactive item at risk of automatic closure. label Oct 27, 2026
@github-actions

Copy link
Copy Markdown

This pull request has had no activity for 14 days and is now marked stale.

@github-actions github-actions Bot added the state:stale Inactive item at risk of automatic closure. label Nov 11, 2026
@purp purp added area:runtime Sandbox execution, isolation, supervision, policy enforcement, networking, and provider lifecycle. topic:security Vulnerability management, security analysis/auditing, bypass detection, and abuse prevention. labels Nov 15, 2026
@github-actions github-actions Bot removed the state:stale Inactive item at risk of automatic closure. label Nov 15, 2026
Signed-off-by: Drew Newberry <anewberry@nvidia.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:runtime Sandbox execution, isolation, supervision, policy enforcement, networking, and provider lifecycle. topic:security Vulnerability management, security analysis/auditing, bypass detection, and abuse prevention.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(sandbox): GNU Make cannot launch recipes with unchanged UID/GID

3 participants