Skip to content

fix(bash): validate workdir exists before spawning shell (#189)#190

Merged
randomm merged 1 commit intodevfrom
fix/issue-189-validate-bash-workdir
Feb 17, 2026
Merged

fix(bash): validate workdir exists before spawning shell (#189)#190
randomm merged 1 commit intodevfrom
fix/issue-189-validate-bash-workdir

Conversation

@randomm
Copy link
Owner

@randomm randomm commented Feb 17, 2026

Summary

Validates bash tool workdir parameter exists before spawning shell. Falls back to Instance.directory with warning log if LLM provides non-existent path.

Changes

  • Added realpath resolution and path normalization in bash.ts
  • Added directory existence validation with Instance.containsPath() fallback
  • Added comprehensive tests (20/20 pass)
  • Updated .fork-features/manifest.json

Security

  • Rejects empty/whitespace workdir at Zod schema level
  • Resolves symlinks securely (rejects on realpath failure)
  • Normalizes Windows paths
  • Enforces project boundary validation

Testing

  • Valid workdir → uses it
  • Non-existent workdir → falls back to Instance.directory
  • Missing workdir → uses Instance.directory (default)

Fixes #189

- Added realpath resolution and path normalization
- Added directory existence validation with Instance.containsPath() fallback
- Added comprehensive tests (20/20 pass)
- Updated .fork-features/manifest.json

Security improvements:
- Rejects empty/whitespace workdir at Zod schema level
- Resolves symlinks securely
- Normalizes Windows paths
- Enforces project boundary validation
@randomm randomm merged commit f50da32 into dev Feb 17, 2026
1 check passed
@randomm randomm deleted the fix/issue-189-validate-bash-workdir branch February 17, 2026 10:21
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.

fix(bash): Validate workdir exists before spawning shell — defend against LLM path hallucination

1 participant