Repository navigation
Description
Problem
_is_safe_workspace_path in src/devops_cli/ai/tools/builtin_tools.py returns False when target.is_symlink(). No public tool reaches this branch. Each caller (list_files, search_code, read_file, _is_valid_dir_entry, _is_searchable_file, _workspace_target) resolves the path first, and a resolved path is never a symlink. A mutation run that deletes the branch leaves all tests green.
Wanted
Delete the dead branch. The is_safe_subpath check stays. A link that points out of the workspace is still denied, because the resolved target lies outside it. The tests in tests/security/test_builtin_tools.py already prove this.
Source
Review of the pull request for #3761.
Alternatives check of 2026-11-08: not-applicable.
Class: refactor, no search.
Tool: none found.
Proposed design
Problem statement
The function _is_safe_workspace_path in src/devops_cli/ai/tools/builtin_tools.py returns False when target.is_symlink(). No caller reaches this branch, because each caller resolves the path first and a resolved path is never a symlink. The branch is dead code. It also suggests a protection that the code does not give. The is_safe_subpath check alone keeps the workspace boundary.
Acceptance criteria
Requirement: Dead symlink guard removed
The function _is_safe_workspace_path SHALL decide only by the is_safe_subpath check and SHALL NOT call is_symlink().
Scenario: A path inside the workspace is allowed
- WHEN
read_filereads a regular file inside the workspace - THEN The reply is the content of the file, as before the change.
Requirement: Link out of the workspace stays denied
The tools read_file and list_files MUST deny a symbolic link whose resolved target lies outside the workspace.
Scenario: A link that points out of the workspace
- WHEN
read_fileis called on a link in the workspace that points to a file outside it, andlist_filesis called on a link that points to a directory outside it - THEN
read_filereturns the access denied reply andlist_filesreturns an empty list.
Requirement: Link inside the workspace stays readable
The tool read_file SHALL read a symbolic link whose resolved target lies inside the workspace.
Scenario: A link that points inside the workspace
- WHEN
read_fileis called on a link in the workspace that points to a file in the workspace - THEN The reply is the content of the target file.
Existing Tool Considered
No outside tool applies. The change deletes two lines of code and adds none. The alternatives check gave not-applicable for a refactor. The cost is one small edit and one run of the existing tests, with no new maintenance.
Key questions
- Does any caller of
_is_safe_workspace_pathpass an unresolved path, so that the symlink branch is live?: No. The callerslist_files,read_file,search_code,_is_valid_dir_entry,_is_searchable_fileand_workspace_targetall callresolve()on the path before the check. A resolved path is never a symlink. The function has no other caller, and the existing testtest_a_path_outside_the_workspace_is_denied_and_so_is_a_link_out_of_itcovers the link cases through the public tools. [sources: src/devops_cli/ai/tools/builtin_tools.py, tests/security/test_builtin_tools.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 6, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
refactorprefix of the title gives the type.(security)scope of the title gives the scope.Removing unreachable dead code has no user-facing effect and no risk.No behaviour changes; it only simplifies the code path.Delete one branch and confirm existing tests still pass.Both work on workspace path checks in builtin_tools.py, but the candidate removes dead code while #2440 adds a missing boundary check for uv audit.devops-cli-service commentedon Nov 8, 2026
Alternatives check: not-applicable
Class: refactor. The check makes no search and no model call for an item of this class.
Tool: none found
Checked on 2026-11-08. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 9, 2026
Status set to Ready at 1b37dbc (see proposed design in issue body).
devops-cli-service commentedon Nov 14, 2026
Released in v0.138.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.138.0
devops-cli-service commentedon Nov 14, 2026
Live since 2026-11-14 15:02 UTC