Skip to content
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

WebLab calls fail fast when filename is too long #24792

Merged
merged 1 commit into from Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions shared/middleware/files_api.rb
Expand Up @@ -576,6 +576,7 @@ def files_put_file(encrypted_channel_id, filename, body)
unescaped_filename = CGI.unescape(filename)
unescaped_filename_downcased = unescaped_filename.downcase
bad_request if unescaped_filename_downcased == FileBucket::MANIFEST_FILENAME
bad_request if unescaped_filename_downcased.length > FileBucket::MAXIMUM_FILENAME_LENGTH

bucket = FileBucket.new
manifest = get_manifest(bucket, encrypted_channel_id)
Expand Down
1 change: 1 addition & 0 deletions shared/middleware/helpers/file_bucket.rb
Expand Up @@ -3,6 +3,7 @@
#
class FileBucket < BucketHelper
MANIFEST_FILENAME = 'manifest.json'.freeze
MAXIMUM_FILENAME_LENGTH = 512

def initialize
super CDO.files_s3_bucket, CDO.files_s3_directory
Expand Down