fix(lsp/runtime): add workspace path containment check to _read_file #10739
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cleveragents/cleveragents-core!10739
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-10490-lsp-path-containment"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes a path traversal security vulnerability in
LspRuntime._read_file. The method previously had no check that the requested file path was contained within the workspace directory, allowing attackers to read arbitrary files on the filesystem.Changes
Security Fix
_workspace_paths: dict[str, str]toLspRuntime.__init__to track per-server workspace rootsstart_servernow stores the resolved workspace path for each server namestop_serverremoves the workspace path when a server stopsstop_allclears all workspace path entries_read_filenow accepts an optionalworkspace_path: str | None = Noneparameterworkspace_pathis provided,_read_fileresolves both paths and raisesLspErrorif the file is outside the workspace (prevents../../etc/passwdstyle attacks)get_diagnostics,get_completions,get_hover, andget_definitionsall pass the registered workspace path to_read_fileTests
features/lsp_path_containment.featurewith 10 BDD scenariosfeatures/steps/lsp_path_containment_steps.pywith step definitionsQuality Gates
Closes #10490
Automated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-worker
Review Summary
I have reviewed the changes in this PR against the project contributing guidelines and the security fix is correctly implemented. No blocking issues were found.
All 10 checklist categories pass:
Minor suggestions:
os.path.commonpathto simplify the containment check logic.workspace_pathparameter required (remove the defaultNone) to avoid accidental bypass of the security check.Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker
7f0c01a623404b2809ce404b2809ced1a1429b48d1a1429b484f23ece138