Skip to content

fix(sandbox): setgroups deny + euid rootfs prepare for setpriv CI - #333

Merged
emigmo merged 3 commits into
mainfrom
fix/hostsandbox-setgroups-deny
Sep 12, 2026
Merged

emigmo merged 3 commits into
mainfrom
fix/hostsandbox-setgroups-deny

Conversation

@emigmo

@emigmo emigmo commented Sep 12, 2026 •

Copy link
Copy Markdown

Summary

  • setgroups: HostSandbox OCI userns sets /proc/self/setgroups=deny. Applying image supplemental groups via setgroups(2) before setuid returned EPERM and blocked non-root entrypoints (/usr/bin/a3s as uid 65532). Skip supplemental setgroups when not allow; primary uid/gid still apply.
  • tmpfs: Put nosuid/nodev in mount flags only (not duplicated in tmpfs data) so kernels that reject unknown tmpfs parameters (e.g. some WSL builds) do not return EINVAL.
  • rootfs prepare: setpriv CI uses non-root ruid with euid 0. Ownership prepare previously keyed off the durable identity and skipped translation, so snapshot capture saw raw host UID 0 outside OCI mappings. Gate prepare on geteuid()==0 instead.

Local evidence (not retained CI)

On Cloud tip 5be6a62 with a Box pin carrying these patches:

  • postgres_skill_workload_binding_rebind_unbind_and_rollback_run_through_real_box → A3S_CLOUD_A0_5_REAL_BOX_SKILL_LIFECYCLE_CERTIFIED (cleanup=removed)
  • postgres_published_agent_release_runs_recovers_and_cleans_through_real_box → A3S_CLOUD_A0_4_REAL_BOX_RELEASE_CERTIFIED (cleanup=removed)

Test plan

  • Unit: setgroups_permitted_matches_proc_file_when_present
  • HostSandbox: non-root image entrypoint (a3s --version as 65532)
  • setpriv: published Agent release / Skill workload Cloud box-conformance after pin bump

ZhiXiao-Lin and others added 2 commits September 13, 2026 00:36
HostSandbox OCI userns sets /proc/self/setgroups=deny, so applying image
supplemental groups before setuid returned EPERM and blocked non-root
entrypoints. Keep primary uid/gid, and put tmpfs nosuid/nodev in mount
flags so WSL kernels do not EINVAL on duplicated superblock options.

Co-authored-by: Cursor <[email protected]>
setpriv CI uses non-root ruid with euid 0. Ownership prepare previously
keyed off the durable identity and skipped translation, so snapshot capture
saw raw host UID 0 outside OCI mappings. Gate prepare on geteuid() instead.

Co-authored-by: Cursor <[email protected]>
@emigmo emigmo changed the title fix(sandbox): skip setgroups when userns denies them fix(sandbox): setgroups deny + euid rootfs prepare for setpriv CI Sep 12, 2026
Unit tests and root-service semantics pass effective_uid == 0 to request
ownership translation even when the process euid is non-root. Combine that
with the setpriv euid==0 path so fully non-root services still skip prepare.
Also rustfmt contextual pre_exec error wrapping.

Co-authored-by: Cursor <[email protected]>
@emigmo
emigmo merged commit bf1ff80 into main Sep 12, 2026
10 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.

2 participants