fix(security): allow serving static files from uploads directory
Test Gitea Actions / test (push) Successful in 14s
continuous-integration/drone/push Build is passing

- Remove overly restrictive absolute path check in isPathSafe
- Strip leading slash from request path before validation
- Fixes broken favicon and watermark image previews in branding page
- Path traversal protection remains intact with ../ pattern checks

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-13 19:43:29 +02:00
parent 66841e8af7
commit 4e977f7624
2 changed files with 2 additions and 3 deletions
-1
View File
@@ -37,7 +37,6 @@ function isPathSafe(filePath) {
// Check for common path traversal patterns
const dangerousPatterns = [
/\.\.[\/\\]/, // ../ or ..\
/^[\/\\]/, // Absolute paths
/^[A-Za-z]:/, // Windows drive letters
/[\x00-\x1f]/ // Control characters
];