Skip to content

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 21, 2026

This PR fixes a path traversal vulnerability where the path parameter in search requests could be used to access files outside the intended directory.

Changes:

  • Validates that the resolved search path starts with the current working directory (or allowed root).
  • Applies validation in both the Server API (src/server/api.rs) and the Core Search Engine (src/core/search.rs).
  • Returns a 400 Bad Request if a traversal attempt is detected in the API.
  • Prevents silent fallback to malicious paths when canonicalization fails, by enforcing the scope check on the resolved path.

Security Impact:
Prevents attackers from using ../ sequences to search or enumerate files outside the indexed/server directory.

Prevent path traversal by validating that search paths resolve to locations within the current working directory (or allowed root). This affects both the HTTP server API and the core search engine logic.

Fixes #201
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.

2 participants