Repository navigation
🛡️ Sentinel: [HIGH] Sanitize UploadInfo.getFileName() to prevent path traversal - #153
Merged
tomdesair merged 1 commit intoNov 15, 2026
Conversation
tomdesair
merged commit Nov 15, 2026
f9f02cf
into
bugfix/cloud-robustness-security-performance
2 checks passed
tomdesair
added a commit
that referenced
this pull request
Nov 15, 2026
…152) * fix: resolve distributed cloud performance, security, and robustness concerns - Fix POST creation-with-upload lock acquisition and watchdog leak: ensure distributed lease lock is acquired for newly created uploadId and released cleanly on stream completion or abortion across Tus and RUFH. - Enforce stream safety and rollback integrity: rollback uncommitted bytes on client stream interruptions and reset tentative length for RUFH deferred length uploads. - Prevent parent upload truncation on child error rollback in S3 and Azure Blob storage services. - Increase S3 server-side compose HTTP timeouts to 60s for large uploads and preserve fallback behavior. - Harden against HTTP request smuggling and DoS: enforce strict CRLF and chunk size validation in chunked transfer encoding stream and bound metadata length. - Optimize pattern compilation using ConcurrentHashMap caching. - Add preliminary request validation in getRawInterimResponse to prevent phantom upload creation on invalid requests. - Add integration test for chunked streaming with trailing checksum verification across Disk, S3, and Azure backends. * fix(security): prevent path traversal in Content-Disposition and add nosniff header in download extension * fix: harden 2.0.0 concurrency, cache eviction, error handling, and docs - Evict pre-lock ThreadLocal cache entries on lock acquisition in ThreadLocalCachedStorageAndLockingService - Harden protocol handlers, validators, stream/header parsing, and Disk/S3/Azure storage, locking, and deduplication - Add unit tests covering new edge cases and error paths - Clean up CHANGELOG.md for 2.0.0 and update AGENTS.md and storage/architecture docs * Harden containerized CI integration tests, extract InMemoryAzureHttpResponse, and improve coverage * fix(security): sanitize UploadInfo.getFileName() to prevent path traversal (#153)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Severity
HIGH
Vulnerability
Path Traversal (CWE-22) and Null-Byte Injection in
UploadInfo.getFileName(). Client-supplied filename metadata (e.g.Upload-Metadata: filename <base64>) was returned verbatim without stripping directory paths (Unix/and Windows\), directory traversal sequences (..), or null bytes (\0). Furthermore, callinggetFileName()on anUploadInfoinstance lacking an ID threw aNullPointerException.Impact
Applications consuming
UploadInfo.getFileName()(e.g. inUploadCompletionListenercallbacks or custom controller endpoints) to write or save uploaded files to a target directory (such asnew File(targetDir, info.getFileName())ortargetDir.resolve(info.getFileName())) are vulnerable to arbitrary file write / path traversal outside the intended directory.Fix
Utils.sanitizeFileName(String fileName, UploadId uploadId)to strip Unix and Windows directory segments, directory traversal sequences (..), and null bytes (\0), safely falling back to the upload ID (or"download"if null).UploadInfo.getFileName()to return the sanitized filename.DownloadGetRequestHandlerto shareUtils.sanitizeFileName.UploadInfoTestandUtilsTestcovering directory traversal patterns, traversal-only strings, null bytes, and null fallbacks.Verification
mvn -P codestyle com.spotify.fmt:fmt-maven-plugin:format -q(100% compliant).mvn test -Dtest="*Test" -q).python3 scripts/check-coverage.py --per-file-limit 90).