infra: drop no-new-privileges (breaks exec under snap Docker)
- Commit
ace20dee2aeb5282c7c36f4c58a0d4ce3da38274- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-05 01:46 UTC (1 month ago)
- Parents
591cee3
On maproj, snap Docker's AppArmor confinement turns no-new-privileges into EPERM on every exec (tini, bash and agent-runner all fail; verified by bisecting user / cap_drop / no-new-privileges on throwaway containers), so the builder crash-looped. Remove it from builder and agentd and keep the same guarantee by stripping every setuid/setgid bit from the builder image: with cap_drop ALL, a non-root uid and no setuid binaries there is no privilege-gain path left.
Diff
infra/agents/Dockerfile.builder
diff --git a/infra/agents/Dockerfile.builder b/infra/agents/Dockerfile.builderindex 2241a018f9..9d9e878dd9 100644--- a/infra/agents/Dockerfile.builder+++ b/infra/agents/Dockerfile.builder@@ -60,6 +60,10 @@ RUN groupadd -g 10001 agent \ COPY --from=runner-build /src/target/release/agent-runner /usr/local/bin/agent-runner +# Stand-in for no-new-privileges (unusable under snap Docker, see compose.yml):+# with no setuid/setgid binaries, the uid-10001 sandbox has no path to root.+RUN find / -xdev -type f -perm /6000 -exec chmod a-s {} + 2>/dev/null || true+ # Gradle memory/concurrency profile for the 6-CPU / 14 GB sandbox (smaller # than release builds: 4 workers / 12 GB). builder-init copies this into # /gradle-cache/gradle.properties on first boot; a repo-level
infra/agents/compose.yml
diff --git a/infra/agents/compose.yml b/infra/agents/compose.ymlindex 967fe6468b..8c1919e093 100644--- a/infra/agents/compose.yml+++ b/infra/agents/compose.yml@@ -77,10 +77,11 @@ services: memswap_limit: 16g pids_limit: 4096 cpu_shares: 256+ # No `no-new-privileges`: under snap Docker's AppArmor confinement it makes+ # every exec fail with EPERM. Equivalent protection comes from cap_drop ALL+ # + non-root uid + an image with all setuid/setgid bits stripped. cap_drop: - ALL- security_opt:- - no-new-privileges:true restart: unless-stopped environment: RUNNER_LISTEN: "0.0.0.0:7070"@@ -120,10 +121,9 @@ services: - agents-mirror:/mirror - agents-signal:/signal:ro mem_limit: 1g+ # See builder: no-new-privileges breaks exec under snap Docker. cap_drop: - ALL- security_opt:- - no-new-privileges:true restart: unless-stopped networks: agents-internal: