Restrict mount/pivot_root/userns to nsjail via AppArmor profile transition - #371
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
| Filename | Overview |
|---|---|
| charts/retool/templates/apparmor_nsjail_configmap.yaml | Introduces the scoped nsjail child profile, but removes an installer-required ConfigMap key and does not update integration tests for the new policy contract. |
Reviews (1): Last reviewed commit: "Restrict mount/pivot_root/userns to nsja..." | Re-trigger Greptile
…ition Replace the broad retool-executor AppArmor profile (which granted mount, pivot_root, umount, userns to the entire container) with a two-profile design using a mandatory exec transition (px): - retool-executor: container's main profile — network, capability, file only. No mount/pivot_root/userns. Node.js cannot call these directly. - retool-executor//nsjail: child profile entered only when exec'ing /usr/bin/nsjail. Adds mount, pivot_root, umount, userns. The old standalone usr.bin.nsjail profile (flags=unconfined) is removed — nsjail now runs under the scoped child profile with the same deny rules as the parent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove usr.bin.nsjail copy/load from DaemonSet — the child profile retool-executor//nsjail is defined inside the retool-executor entry and loaded by apparmor_parser together with it. - Update test to check for retool-executor//nsjail in kernel instead of /usr/bin/nsjail. - Flip the unshare assertion: under the parent profile, unshare --user --mount must now FAIL (mount/userns restricted to nsjail via px). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
466d100 to
d179275
Compare

Summary
retool-executorAppArmor profile with a two-profile design using a mandatory exec transition (px)retool-executor) no longer grantsmount,pivot_root,umount, oruserns— Node.js and all other processes in the container cannot call these syscalls/usr/bin/nsjailgets these permissions, via automatic AppArmor profile transition toretool-executor//nsjailon execusr.bin.nsjailprofile (which wasflags=(unconfined), effectively unrestricted)Before
After
Stacked on
Test plan
mount()syscall from Node.js is denied by AppArmor🤖 Generated with Claude Code