Skip to content

Validate filesystem storage paths#195

Merged
andrew merged 2 commits into
mainfrom
fix-filesystem-storage-path-validation
Jul 9, 2026
Merged

Validate filesystem storage paths#195
andrew merged 2 commits into
mainfrom
fix-filesystem-storage-path-validation

Conversation

@andrew

@andrew andrew commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • validate filesystem storage object paths before joining them under the storage root
  • reject traversal, absolute, malformed slash, empty, and backslash paths across filesystem operations
  • preserve empty-prefix listing behavior for ListPrefix

Testing

  • go test ./internal/storage
  • go test ./...

Addresses CodeQL alerts for uncontrolled data used in path expressions in internal/storage/filesystem.go.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens internal/storage’s filesystem-backed storage by validating object paths before joining them under the storage root, preventing path traversal/absolute-path issues while keeping ListPrefix("") behavior intact.

Changes:

  • Introduce cleanStoragePath validation and route all filesystem operations through it via fullPath.
  • Add prefixPath to preserve empty-prefix listing semantics for ListPrefix.
  • Expand tests to cover rejection of absolute, traversal, malformed slash/dot-segment, empty, and backslash-containing paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/storage/filesystem.go Adds centralized storage-path validation and special-cases empty prefix handling for ListPrefix.
internal/storage/filesystem_test.go Expands invalid-path coverage and adds a dedicated test for empty-prefix listing behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/storage/filesystem_test.go
@andrew andrew merged commit 18c711b into main Jul 9, 2026
8 checks passed
@andrew andrew deleted the fix-filesystem-storage-path-validation branch July 9, 2026 16:59
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