Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

throw IllegalArgumentException(
"Invalid filename: '${file.filename}'. '..' and '/' are not allowed")
}

logger.debug(
"Uploading file resource to workspace #{} ({}): {} => {}",
Expand Down
Loading