Skip to content

Security: Fix path traversal vulnerability in PreviewImageStore#93

Open
trek-e wants to merge 2 commits intorubenwe:masterfrom
trek-e:security/fix-path-traversal-previewstore
Open

Security: Fix path traversal vulnerability in PreviewImageStore#93
trek-e wants to merge 2 commits intorubenwe:masterfrom
trek-e:security/fix-path-traversal-previewstore

Conversation

@trek-e
Copy link
Copy Markdown

@trek-e trek-e commented Jan 24, 2026

Summary

  • Fixes path traversal vulnerability in PreviewImageStore.cs
  • Malicious file hashes could potentially write/read files outside the preview directory

Security Impact

  • Severity: Medium
  • Attack Vector: Malicious file hash containing path traversal sequences
  • Impact: Arbitrary file read/write outside intended directory

Changes

  1. Explicit removal of path separators (/ and ) from file hash
  2. Explicit removal of parent directory references (..)
  3. Final validation that resolved path is within expected directory
  4. Added null/empty check for file hash input

Test plan

  • Verify normal preview storage still works
  • Verify hashes with special characters are handled safely
  • Verify path traversal attempts are blocked

🤖 Generated with Claude Code

trek-e and others added 2 commits January 23, 2026 18:39
- STACK.md - Technologies and dependencies
- ARCHITECTURE.md - System design and patterns
- STRUCTURE.md - Directory layout
- CONVENTIONS.md - Code style and patterns
- TESTING.md - Test structure
- INTEGRATIONS.md - External services
- CONCERNS.md - Technical debt and issues
The GetFileName method could be vulnerable to path traversal attacks
if a malicious file hash contained path components like "../" or
directory separators.

This fix adds:
- Explicit removal of path separators (/ and \)
- Explicit removal of parent directory references (..)
- Final validation that the resolved path is within the expected directory
- Null/empty check for file hash input

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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