aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/controllers
Commit message (Collapse)AuthorAgeFilesLines
* url -> URL where apt except inside actionpack/Sharang Dashputre2019-04-011-1/+1
|
* Revert ensure external redirects are explicitly allowedGannon McGibbon2019-01-222-2/+2
|
* Fix ArgumentError: Unsafe redirectYuichi Takeuchi2019-01-212-2/+2
|
* Prevent content type and disposition bypass in storage service URLsRosa Gutierrez2018-11-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Force content-type to binary on service urls for relevant content types We have a list of content types that must be forcibly served as binary, but in practice this only means to serve them as attachment always. We should also set the Content-Type to the configured binary type. As a bonus: add text/cache-manifest to the list of content types to be served as binary by default. * Store content-disposition and content-type in GCS Forcing these in the service_url when serving the file works fine for S3 and Azure, since these services include params in the signature. However, GCS specifically excludes response-content-disposition and response-content-type from the signature, which means an attacker can modify these and have files that should be served as text/plain attachments served as inline HTML for example. This makes our attempt to force specific files to be served as binary and as attachment can be easily bypassed. The only way this can be forced in GCS is by storing content-disposition and content-type in the object metadata. * Update GCS object metadata after identifying blob In some cases we create the blob and upload the data before identifying the content-type, which means we can't store that in GCS right when uploading. In these, after creating the attachment, we enqueue a job to identify the blob, and set the content-type. In other cases, files are uploaded to the storage service via direct upload link. We create the blob before the direct upload, which happens independently from the blob creation itself. We then mark the blob as identified, but we have already the content-type we need without having put it in the service. In these two cases, then, we need to update the metadata in the GCS service. * Include content-type and disposition in the verified key for disk service This prevents an attacker from modifying these params in the service signed URL, which is particularly important when we want to force them to have specific values for security reasons. * Allow only a list of specific content types to be served inline This is different from the content types that must be served as binary in the sense that any content type not in this list will be always served as attachment but with its original content type. Only types in this list are allowed to be served either inline or as attachment. Apart from forcing this in the service URL, for GCS we need to store the disposition in the metadata. Fix CVE-2018-16477.
* Use content_mime_typeGraham Conzett2018-10-081-2/+1
|
* Fix issue ActiveStorage direct upload diskGraham Conzett2018-10-071-1/+2
| | | | | | Fix an issue in ActiveStorage where a direct upload to disk storage would fail due to a content type mismatch if the file was uploaded using a mime-type synonym.
* Respond with 404 in ActiveStorage::DiskController#show when file missingCameron Bothner2018-08-211-0/+2
| | | | | | `ActiveStorage::DiskController#show` generates a 404 Not Found response when the requested file is missing from the disk service. It previously raised `Errno::ENOENT`.
* Extract ActiveStorage::SetCurrentGeorge Claghorn2018-08-162-5/+18
| | | | Provide a handy concern for custom Active Storage controllers that can't inherit from ActiveStorage::BaseController.
* Restore inadvertently-removed fallbackGeorge Claghorn2018-07-151-1/+2
|
* Support HTTP Range downloads from diskGeorge Claghorn2018-07-151-14/+15
| | | | Closes #32193.
* Permit configuring the default service URL expiryGeorge Claghorn2018-06-212-2/+2
|
* Stream blobs from diskGeorge Claghorn2018-05-021-2/+13
|
* Always exclude JSON root from direct_uploads#create responseJavan Makhmali2018-04-101-1/+1
| | | | | | The JavaScript component expects a bare response. Fixes #32365
* Use a current model to provide the host for service urlsAndrew White2018-04-061-0/+4
| | | | | | | Trying to pass the current request down to the service so that it can create full urls instead of paths makes the API messy so use a model based on ActiveSupport::CurrentAttributes to provide the current host to services that need it (primarily the disk service).
* Protect all active storage controllers agains CSRFRafael Mendonça França2018-04-065-5/+11
| | | | | Before it was possible to for example use the direct upload controller without using the site.
* Merge Previews/Variants controller into one Representations controller.Kasper Timm Hansen2018-03-032-13/+3
| | | | | | | | | Since ActiveStorage::Blob::Representable unifies the idea of previews and variants under one roof as representation, we may as well have the controllers follow suit. Thus ActiveStorage::RepresenationsController enters the fray. I've copied the old tests for both previews and variants and unified those as well.
* Exclude ActiveStorage::SetBlob from API docs [ci skip]George Claghorn2018-01-021-1/+1
|
* Handle invalid signed blob IDs gracefullyGeorge Claghorn2017-12-154-18/+28
|
* Fix loading ActiveStorage::DiskController when CSRF protection is disabled ↵George Claghorn2017-11-211-1/+1
| | | | by default
* Fix direct uploads to local serviceGeorge Claghorn2017-11-201-0/+2
| | | | | | | | Disable CSRF protection for ActiveStorage::DiskController#update. The local disk service is intended to imitate a third-party service like S3 or GCS, so we don't care where direct uploads originate: they’re authorized by signed tokens. Closes #30290. [Shinichi Maeshima & George Claghorn]
* Preview PDFs and videosGeorge Claghorn2017-09-284-33/+19
|
* DRYGeorge Claghorn2017-08-201-2/+2
|
* restores some double newlines deleted in ae87217Xavier Noria2017-08-151-0/+2
| | | | | | These were intentional, see https://github.com/rails/rails/pull/30061#issuecomment-320068368
* minor tweaks in Active Storage after a walkthroughXavier Noria2017-08-151-2/+0
|
* Use frozen string literal in Active StorageKoichi ITO2017-08-124-0/+8
|
* Enable browser caching for blobs and variants (#30196)Anton Khamets2017-08-112-0/+2
|
* Do not eager load ActiveRecord::BaseRafael Mendonça França2017-08-031-2/+0
| | | | Everything inside the app directory of a engine is autoload/eager loaded automatically so we don't need to require them.
* Add 'activestorage/' from commit '3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58'Rafael Mendonça França2017-07-314-0/+122
git-subtree-dir: activestorage git-subtree-mainline: 0d58e7e478e79c2d6b2a39a4444d2a17a903b2a6 git-subtree-split: 3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58