fix(entrypoint): bind-mount passwd/group synthesis fallback for read-only /host/etc (ARC/DinD)#4831
fix(entrypoint): bind-mount passwd/group synthesis fallback for read-only /host/etc (ARC/DinD)#4831Copilot wants to merge 4 commits into
Conversation
When entrypoint.sh cannot append to /host/etc/passwd or /host/etc/group because the filesystem is read-only (ARC/DinD with tmpfs-backed daemon root), copy the existing file to /tmp/awf-etc/ and bind-mount it over the read-only original after appending the synthesized entry. CAP_SYS_ADMIN is still held at entrypoint time (dropped by capsh before user code runs), so mount --bind succeeds. This replaces the [WARN] + continue path that caused downstream capsh identity resolution failures. Also update docs/chroot-mode.md to describe the new bind-mount fallback. Closes #4829
There was a problem hiding this comment.
Pull request overview
This PR improves chroot-mode identity synthesis on ARC/DinD runners by adding a bind-mount fallback when /host/etc/passwd and /host/etc/group are read-only, preventing capsh from falling back to numeric UID/GID and breaking identity-dependent features.
Changes:
- Add a read-only fallback path in
containers/agent/entrypoint.shthat writes synthesized passwd/group entries to/tmp/awf-etc/and bind-mounts them over/host/etc/*. - Update chroot-mode documentation to describe the new bind-mount fallback and its
CAP_SYS_ADMINdependency.
Show a summary per file
| File | Description |
|---|---|
| containers/agent/entrypoint.sh | Adds bind-mount fallback for passwd/group synthesis when /host/etc is read-only in ARC/DinD. |
| docs/chroot-mode.md | Documents the new runtime bind-mount fallback behavior and capability requirement. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
🔬 Smoke Test Results — Auth mode: PAT (COPILOT_GITHUB_TOKEN)
PR: fix(entrypoint): bind-mount passwd/group synthesis fallback for read-only /host/etc (ARC/DinD) Overall: ✅ PASSNote 🔒 Integrity filter blocked 1 itemThe following item was blocked because it doesn't meet the GitHub integrity level.
To allow these resources, lower tools:
github:
min-integrity: approved # merged | approved | unapproved | none
|
|
Smoke Test Results: Copilot BYOK (Direct Mode)
Mode:
|
Smoke Test
|
Smoke Test Results
Overall: FAIL — workflow template variables ( PR: fix(entrypoint): bind-mount passwd/group synthesis fallback for read-only /host/etc (ARC/DinD) Note 🔒 Integrity filter blocked 1 itemThe following item was blocked because it doesn't meet the GitHub integrity level.
To allow these resources, lower tools:
github:
min-integrity: approved # merged | approved | unapproved | none
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test: GitHub Actions Services Connectivity
Overall: FAIL —
|
|
Overall: PASS
|
On ARC/DinD runners the Docker daemon's root filesystem is often read-only or tmpfs-backed, so
entrypoint.sh's runtime identity synthesis silently failed when appending to/host/etc/passwdand/host/etc/group. This causedcapshto fall back to numeric UID/GID — breaking threat-detection and requiring consumers to pre-seed the daemon's/etc/passwdas a workaround.Changes
containers/agent/entrypoint.shWhen appending to
/host/etc/passwd(or/host/etc/group) fails (EROFS), falls back to:/tmp/awf-etc/mount --binding the copy over the read-only originalCAP_SYS_ADMINis still held at this point in the entrypoint (dropped bycapshjust before user code runs), so the bind-mount succeeds. The mount is container-scoped and cleaned up on exit.docs/chroot-mode.md