fix(ci): scope AppArmor userns exemption to bwrap instead of runner-wide#705
Merged
Conversation
Ubuntu 24.04's AppArmor default blocks unprivileged CLONE_NEWUSER for otherwise-unconfined processes, which bwrap needs for rootless sandboxing. The previous fix disabled the restriction runner-wide via kernel.apparmor_restrict_unprivileged_userns=0; this loads a profile scoped to /usr/bin/bwrap that grants it userns creation directly, so every other process on the runner keeps the restriction. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
CLONE_NEWUSERfor otherwise-unconfined processes, whichbwrapneeds for rootless sandboxing.kernel.apparmor_restrict_unprivileged_userns=0. This replaces it with an AppArmor profile scoped to/usr/bin/bwrapthat grants only that binaryuserns,— every other process on the runner keeps the restriction.Test plan
integrationCI job (bothbwrapandsrtbackends) passes onubuntu-24.04with this profile in place instead of the sysctl togglesandboxr doctoroutput in the CI log shows the same probe results as before (no regression)Can't validate locally: WSL2's kernel has no AppArmor LSM at all, so a real GH Actions
ubuntu-24.04run is the only way to exercise this.🤖 Generated with Claude Code