mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-04 16:38:49 +00:00
The shell safety guard in _guard_command() checked extracted absolute paths only against cwd_path (the command's working directory). When cwd was a subdirectory like ~/.nanobot/workspace/obsidian_notes, any absolute path referencing the broader workspace (e.g. a sibling directory or the workspace root itself) was incorrectly blocked with "path outside working dir". Fix: pass the workspace_root from _prepare_command() into _guard_command() and check absolute paths against it as a fallback when they are outside cwd_path. Paths truly outside the workspace root are still blocked. Added tests: - test_exec_allows_workspace_paths_from_subdirectory - test_exec_blocks_outside_paths_from_subdirectory