gitlab-org--gitlab-foss/spec
Nick Thomas 5b075413d9
Verify that LFS upload requests are genuine
LFS uploads are handled in concert by workhorse and rails. In normal
use, workhorse:

* Authorizes the request with rails (upload_authorize)
* Handles the upload of the file to a tempfile - disk or object storage
* Validates the file size and contents
* Hands off to rails to complete the upload (upload_finalize)

In `upload_finalize`, the LFS object is linked to the project. As LFS
objects are deduplicated across all projects, it may already exist. If
not, the temporary file is copied to the correct place, and will be
used by all future LFS objects with the same OID.

Workhorse uses the Content-Type of the request to decide to follow this
routine, as the URLs are ambiguous. If the Content-Type is anything but
"application/octet-stream", the request is proxied directly to rails,
on the assumption that this is a normal file edit request. If it's an
actual LFS request with a different content-type, however, it is routed
to the Rails `upload_finalize` action, which treats it as an LFS upload
just as it would a workhorse-modified request.

The outcome is that users can upload LFS objects that don't match the
declared size or OID. They can also create links to LFS objects they
don't really own, allowing them to read the contents of files if they
know just the size or OID.

We can close this hole by requiring requests to `upload_finalize` to be
sourced from Workhorse. The mechanism to do this already exists.
2019-01-31 16:52:48 +01:00
..
bin Enable the Layout/ExtraSpacing cop 2019-01-24 13:05:45 +01:00
config
controllers Use common error for unauthenticated users 2019-01-31 16:51:17 +01:00
db
dependencies
factories Update Sentry client to get project list 2019-01-31 10:05:29 +00:00
features Merge branch 'anan-add-MethodCallWithoutArgsParentheses-cop' into 'master' 2019-01-30 10:02:38 +00:00
finders Group Guests are no longer able to see merge requests 2019-01-31 16:51:54 +01:00
fixtures Extract GitLab Pages using RubyZip 2019-01-31 16:52:48 +01:00
frontend
graphql Enable the Layout/ExtraSpacing cop 2019-01-24 13:05:45 +01:00
helpers Add `sanitize_name` helper to sanitize URLs in user full name 2019-01-31 16:52:21 +01:00
initializers
javascripts Support for ignore rules in 'convertObjectPropsToCamelCase' helper 2019-01-31 17:02:46 +05:30
lib Extract GitLab Pages using RubyZip 2019-01-31 16:52:48 +01:00
mailers Use `sanitize_name` to sanitize URL in user full name 2019-01-31 16:52:48 +01:00
migrations Sidekiq queue migration for HashedStorage::MigratorWorker 2019-01-25 20:26:35 +01:00
models Prevent comments by email when issue is locked 2019-01-31 16:52:48 +01:00
policies Prevent comments by email when issue is locked 2019-01-31 16:52:48 +01:00
presenters Fix subject in trigger presenter tests 2019-01-31 16:51:18 +01:00
rack_servers
requests Verify that LFS upload requests are genuine 2019-01-31 16:52:48 +01:00
routing Add ability to resolve project id into path 2019-01-22 09:59:10 +02:00
rubocop
serializers Merge branch 'cluster_status_for_ugprading' into 'master' 2019-01-30 15:06:32 +00:00
services Extract GitLab Pages using RubyZip 2019-01-31 16:52:48 +01:00
sidekiq/cron
support Re-enable MethodCallWithoutArgsParentheses Cop 2019-01-29 21:05:30 +02:00
tasks Refactor Storage Migration 2019-01-25 20:26:35 +01:00
uploaders Enable the Layout/ExtraSpacing cop 2019-01-24 13:05:45 +01:00
validators
views Fixed bug when external wiki is enabled 2019-01-31 16:51:53 +01:00
workers Refactor Storage Migration 2019-01-25 20:26:35 +01:00
factories_spec.rb
fast_spec_helper.rb
rails_helper.rb
rake_helper.rb
simplecov_env.rb
spec_helper.rb Revert the "What's new" feature 2019-01-29 20:45:47 +00:00