Skip to content

fix: validate per-call workdir before passing to docker exec - #4978

Closed
bugkill3r wants to merge 1 commit into
NousResearch:mainfrom
bugkill3r:fix/validate-docker-workdir-4669
Closed

fix: validate per-call workdir before passing to docker exec#4978
bugkill3r wants to merge 1 commit into
NousResearch:mainfrom
bugkill3r:fix/validate-docker-workdir-4669

Conversation

@bugkill3r

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • Terminal tool call with valid absolute workdir — works as before
  • Terminal tool call with workdir containing .. — falls back to session cwd, logs warning
  • Terminal tool call with relative workdir — falls back to session cwd, logs warning
  • Terminal tool call without workdir — uses session cwd (default behavior preserved)

…earch#4669)

When a terminal tool call includes an invalid workdir (e.g. containing
path traversal), it was passed directly to docker exec -w, causing OCI
runtime errors. Add _validate_workdir() that rejects non-absolute paths
and paths containing "..", falling back to the configured session cwd.
@teknium1

teknium1 commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

This is now fixed via PR #5629 (merged), which sanitizes workdir with tilde-aware shlex.quote + an allowlist validator. Thanks for flagging the vulnerability!

@teknium1 teknium1 closed this Apr 6, 2026
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.

[Bug]: terminal tool passes invalid workdir to Docker exec and overrides configured terminal.cwd

2 participants