Skip to content

runner: use MkdirTemp for non-root RunDir fallback - #644

Merged
aprajitaarora13 merged 1 commit into
mainfrom
aprajitaarora/runner-mkdirtemp-rundir
Nov 18, 2026
Merged

aprajitaarora13 merged 1 commit into
mainfrom
aprajitaarora/runner-mkdirtemp-rundir

Conversation

@aprajitaarora13

Copy link
Copy Markdown
Collaborator

Follows up on the non-blocking review comment on #624:

  • Replaces the predictable /tmp/ax-run fallback in ensureRunDir with os.MkdirTemp("", "ax-run-*") (mode 0700), avoiding shared-path collisions or pre-created directory games when a container image runs as a non-root USER.
  • Passes a.cfg.RunDir directly from runner/pull.go into writeLauncherFiles so pull-mode tasks also get the same non-root fallback when Config.RunDir is empty.
  • Updates TestRun_FallsBackWhenDefaultRunDirUnwritable to isolate TMPDIR and verify a unique ax-run-* directory is created.

Part of #493.

Follow up on the non-blocking review comment on #624:

- Use `os.MkdirTemp("", "ax-run-*")` instead of a shared, predictable
  `/tmp/ax-run` path when `Config.RunDir` is empty and `/run/ax` is not
  writable by a non-root container user.
- Pass `a.cfg.RunDir` directly in `runner/pull.go` so pull-mode tasks
  get the same non-root fallback.
- Update `TestRun_FallsBackWhenDefaultRunDirUnwritable` to isolate
  `TMPDIR` and verify a unique `ax-run-*` directory is created.

Part of #493.

@mayawang mayawang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for picking this up, LGTM

@aprajitaarora13
aprajitaarora13 merged commit 3be65a4 into main Nov 18, 2026
10 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