Skip to content

fix: make bwrap setuid-root to fix sandbox e2e tests#1690

Merged
EItanya merged 3 commits intokagent-dev:mainfrom
supreme-gg-gg:chore/pin-versions
Apr 17, 2026
Merged

fix: make bwrap setuid-root to fix sandbox e2e tests#1690
EItanya merged 3 commits intokagent-dev:mainfrom
supreme-gg-gg:chore/pin-versions

Conversation

@supreme-gg-gg
Copy link
Copy Markdown
Contributor

@supreme-gg-gg supreme-gg-gg commented Apr 17, 2026

Sets the setuid bit on /usr/bin/bwrap in both runtime Dockerfiles so the non-root agent process (uid 1001) can create the user + network namespaces that bubblewrap relies on to sandbox skills and executed code. Without this, hosts with kernel.apparmor_restrict_unprivileged_userns=1 deny bwrap's RTM_NEWADDR call when it brings up loopback, making every sandboxed command fail and blocking two CI e2e tests.

The binary already runs inside a privileged: true Kubernetes pod, so the container already has full host capabilities; setuid only changes which process inside that pod holds them, and bubblewrap is a small, audited tool specifically designed to be setuid-safe. Privilege mode is dropped before running the user's command.

Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
This reverts commit 0c03da9.

Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
@supreme-gg-gg supreme-gg-gg changed the title [DNM] Try to fix CI fix: make bwrap setuid-root to fix sandbox e2e tests Apr 17, 2026
@supreme-gg-gg supreme-gg-gg marked this pull request as ready for review April 17, 2026 21:38
Copilot AI review requested due to automatic review settings April 17, 2026 21:38
@EItanya EItanya merged commit f82a949 into kagent-dev:main Apr 17, 2026
27 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adjusts the Python and Go ADK runtime container images to ensure bubblewrap (bwrap) can be used by the non-root agent user (uid 1001) on hosts that restrict unprivileged user namespaces, unblocking sandboxed execution in CI/e2e environments.

Changes:

  • Set the setuid bit on /usr/bin/bwrap in the Python runtime Dockerfile.
  • Set the setuid bit on /usr/bin/bwrap in the Go ADK “full” runtime Dockerfile.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
python/Dockerfile Adds chmod u+s /usr/bin/bwrap after installing bubblewrap so sandboxed commands can run under the non-root user.
go/Dockerfile.full Adds chmod u+s /usr/bin/bwrap in the final runtime image so Go ADK sandbox execution works under uid 1001.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

shmuelarditi pushed a commit to shmuelarditi/kagent that referenced this pull request Apr 19, 2026
Sets the setuid bit on `/usr/bin/bwrap` in both runtime `Dockerfiles` so
the non-root agent process (uid 1001) can create the user + network
namespaces that bubblewrap relies on to sandbox skills and executed
code. Without this, hosts with
`kernel.apparmor_restrict_unprivileged_userns=1` deny bwrap's
`RTM_NEWADDR` call when it brings up loopback, making every sandboxed
command fail and blocking two CI e2e tests.

The binary already runs inside a `privileged: true` Kubernetes pod, so
the container already has full host capabilities; setuid only changes
which process inside that pod holds them, and bubblewrap is a small,
audited tool specifically designed to be setuid-safe. Privilege mode is
dropped before running the user's command.

---------

Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
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.

3 participants