Skip to content

fix: make path traversal check more robust#20

Merged
zjx20 merged 1 commit into
mainfrom
bugfix/path-sanitization
Sep 24, 2025
Merged

fix: make path traversal check more robust#20
zjx20 merged 1 commit into
mainfrom
bugfix/path-sanitization

Conversation

@zjx20
Copy link
Copy Markdown
Contributor

@zjx20 zjx20 commented Sep 24, 2025

The previous check strings.HasPrefix(rpath, "..") could incorrectly flag paths that start with .. but are not actual traversal attempts, such as ..foo.

This commit refines the validation logic to specifically check for .. and ../ prefixes after the path has been cleaned. This ensures that only genuine path traversal attempts are blocked, improving the accuracy of the path sanitization.

@zjx20 zjx20 merged commit d0da948 into main Sep 24, 2025
@zjx20 zjx20 deleted the bugfix/path-sanitization branch September 24, 2025 07:16
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.

1 participant