Skip to content

Fix executor run-directory permission race in #478 - #505

Merged
BaaRai merged 1 commit into
BaaRai:feat/agent-uid-isolation-rebasedfrom
jamesKhor:fix/pr478-executor-sharing-race
Nov 23, 2026
Merged

BaaRai merged 1 commit into
BaaRai:feat/agent-uid-isolation-rebasedfrom
jamesKhor:fix/pr478-executor-sharing-race

Conversation

@jamesKhor

Copy link
Copy Markdown
Contributor

Fix for PR #478 permission race

This follows up the confirmed shareWithExecGroup finding in the review on #478. An executor could swap a run-directory entry for a symlink while the root server was sharing it, redirecting a pathname-based chmod to a root-only file.

The sharing walk now opens each entry relative to its already-open parent with O_NOFOLLOW, and changes ownership and mode through that descriptor. It also refuses regular files with multiple hard links, which could otherwise alias an inode outside the run directory. Existing symlinks remain untraversed.

Verification

  • The concurrent executor regression failed on Run agent processes under the executor identity with a sealed environment #478's original head: a synthetic root-owned 0600 file became 0777. It passes with this fix.
  • A hard-link regression failed before the additional guard and passes with it.
  • go test ./... passed as a non-root user.
  • The full server test binary passed as root, including restored-directory and isolation tests. No live PostgreSQL DSN was configured for this run.
  • go vet ./server and macOS/Windows go build ./server passed.

This PR targets #478's feature branch so its author can incorporate the fix there. The separate conditional LC_ environment-allowlist observation is outside this patch.

@BaaRai
BaaRai merged commit 81d2051 into BaaRai:feat/agent-uid-isolation-rebased Nov 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants