-
Notifications
You must be signed in to change notification settings - Fork 185
S3Mock 5.0.0 #2453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
S3Mock 5.0.0 #2453
Conversation
96b0b36
to
bae04ef
Compare
@JvmStatic | ||
fun hexDigest(file: File): String { | ||
try { | ||
FileUtils.openInputStream(file).use { stream -> |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
@JvmStatic | ||
fun hexDigest(salt: String?, file: File): String { | ||
try { | ||
FileUtils.openInputStream(file).use { stream -> |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 days ago
To fix the issue, we need to validate the uploadId
parameter before using it in path construction. The validation should ensure that uploadId
does not contain path traversal sequences (..
) or path separators (/
, \
). This can be achieved by rejecting any uploadId
that contains these characters.
The validation should be implemented in the MultipartService
class, as it is the central point where uploadId
is used for path construction. This ensures that all usages of uploadId
are protected, regardless of where they originate.
-
Copy modified lines R77-R79
@@ -76,2 +76,5 @@ | ||
Map<String, String> encryptionHeaders) { | ||
if (uploadId.contains("..") || uploadId.contains("/") || uploadId.contains("\\")) { | ||
throw new IllegalArgumentException("Invalid uploadId: Path traversal or separators detected."); | ||
} | ||
var bucketMetadata = bucketStore.getBucketMetadata(bucketName); |
-
Copy modified lines R194-R196
@@ -193,2 +193,5 @@ | ||
Map<String, String> encryptionHeaders) { | ||
if (uploadId.contains("..") || uploadId.contains("/") || uploadId.contains("\\")) { | ||
throw new IllegalArgumentException("Invalid uploadId: Path traversal or separators detected."); | ||
} | ||
var file = inputPathToFile(path, getPartPath(bucket, uploadId, partNumber)); |
a5b22a0
to
9fe17d9
Compare
9fe17d9
to
43f93c7
Compare
Description
Related Issue
Tasks