Skip to content

fix(agent): grant DAC_READ_SEARCH to read restricted deployment dirs - #445

Open
alex289 wants to merge 1 commit into
mainfrom
fix/issue-444
Open

alex289 wants to merge 1 commit into
mainfrom
fix/issue-444

Conversation

@alex289

@alex289 alex289 commented Oct 29, 2026

Copy link
Copy Markdown
Member

Type of change

  • 🐛 Bug fix
  • 🚀 New feature
  • ❓ Other (please specify)

Description

When an application's compose file bind-mounts a directory that is owned by a non-root user with restrictive permissions (e.g. 0700), the agent container could no longer traverse into it to inspect mounts during deployment, causing redeploys to fail.

The agent containers (both the production docker-compose.yml and the one generated by the frontend's agent setup dialog) drop all Linux capabilities for security. This fix re-adds the DAC_READ_SEARCH capability, which allows the agent to read and search restricted deployment directories without granting any write or execute privileges, while still preserving existing symlink checks. The e2e agent compose file and setup dialog test were updated accordingly, and a regression test was added that redeploys an application through a bind mount restricted to 0700 owned by a non-root UID.

Additional context

Fixes #444.

Existing installations need to update their agent Compose configuration and recreate the agent container to pick up the new capability.

Validated locally with backend Docker tests (race detection), the full e2e suite (225 tests), frontend build, typecheck, lint, and formatting.

The agent container could fail to read deployment files when an application's own containers restrict permissions on their mounted directories, since the agent dropped all Linux capabilities and had no way to bypass directory access checks owned by another user.

Add the DAC_READ_SEARCH capability back to the agent container so it can inspect deployment paths regardless of directory permissions set by application containers, and update e2e coverage and the generated compose snippet to match.
@alex289 alex289 self-assigned this Oct 29, 2026
@alex289 alex289 added bug Something isn't working and removed frontend labels Oct 29, 2026
@alex289
alex289 requested a review from timokoessler October 29, 2026 18:49
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread docker-compose.yml
- ALL
cap_add:
# Inspect deployment paths even when application containers restrict directory permissions.
- DAC_READ_SEARCH

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the idea that the agent can bypass all filesystem permissions. It looks dangerous (although we already have docker daemon access). The symlink volume escape thing is really annoying. It can only happen if one container creates a symlink inside a volume first, and then is re-created using the symlink as volume. I found no real solution yet, but maybe this is just something to document rather than to enable by default?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug: Deploy security policy checks fail because of restricted dir permissions

2 participants