Skip to content

Fix Path Traversal Vulnerability in Sandbox Path Resolution#5

Open
kolega-dev-github-app[bot] wants to merge 1 commit into
mainfrom
kolega/fix-00a8be05
Open

Fix Path Traversal Vulnerability in Sandbox Path Resolution#5
kolega-dev-github-app[bot] wants to merge 1 commit into
mainfrom
kolega/fix-00a8be05

Conversation

@kolega-dev-github-app

Copy link
Copy Markdown

Summary

This PR fixes a security vulnerability in the resolvePatchPath function that could allow path traversal attacks to access files outside the intended sandbox boundaries. The fix ensures that all resolved paths remain within the sandbox directories.

Changes

  • Removed the expandPath, resolvePathFromCwd, and toDisplayPath functions, as they were susceptible to path traversal attacks
  • Replaced the vulnerable path resolution logic with a call to the secure assertSandboxPath function, which validates that the final resolved path is within the allowed sandbox directories
  • Maintained the existing code style and did not introduce any new vulnerabilities

Testing

The changes can be tested by running the unit tests for the apply-patch.ts module, which should pass with the new fix in place.

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.

0 participants