Skip to content

fix: check filenames as we do for destination paths #827

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

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

sellisd
Copy link
Contributor

@sellisd sellisd commented Nov 21, 2024

No description provided.

@@ -215,6 +215,10 @@ internal class WorkspaceServiceImpl(
throw IllegalArgumentException("Invalid destination: '$destination'. '..' is not allowed")
}
val workspace = getVerifiedWorkspace(organizationId, workspaceId, PERMISSION_WRITE)
if (file?.filename?.contains("..") == true || file?.filename?.contains("/") == true) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be useful to check for "" too ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The quote is a possible character for a filename (even though not very useful), and since it cannot be abused to write to a different location I think we should keep it

Copy link
Member

@jreynard-code jreynard-code left a comment

Choose a reason for hiding this comment

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

LGTM

@sellisd sellisd merged commit f0fc9b4 into main Nov 26, 2024
33 checks passed
@sellisd sellisd deleted the DSE/secure_file_uploads_PROD-2148 branch November 26, 2024 09:57
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.

3 participants