Skip to content

Prevent path traversal in audio cache#3

Open
phyceClaw wants to merge 1 commit into
phyce:mainfrom
phyceClaw:fix/cache-path-traversal
Open

Prevent path traversal in audio cache#3
phyceClaw wants to merge 1 commit into
phyce:mainfrom
phyceClaw:fix/cache-path-traversal

Conversation

@phyceClaw

Copy link
Copy Markdown

Summary

profileID and character values (which can originate from HTTP requests) were joined directly into filesystem paths in app/cache/cache.go, allowing ../ traversal. ClearProfileCache calls os.RemoveAll, making it an arbitrary-directory-delete primitive.

  • Validates cache path components against an allowlist (^[A-Za-z0-9._-]+$, rejecting ..).
  • Defense-in-depth check that resolved paths stay within the cache root.

Testing

CGO_ENABLED=1 go build ./... passes.

🤖 Generated with Claude Code

profileID and character values (which can come from HTTP requests)
were joined into filesystem paths without validation, allowing
../ escapes; ClearProfileCache could os.RemoveAll outside the cache
dir. Validate cache path components against an allowlist and verify
the resolved path stays within the cache root.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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