aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test/controllers
Commit message (Collapse)AuthorAgeFilesLines
* Fix ArgumentError: Unsafe redirectYuichi Takeuchi2019-01-212-0/+55
|
* text is treated as `attachment`yuuji.yaginuma2018-11-281-2/+2
|
* Prevent content type and disposition bypass in storage service URLsRosa Gutierrez2018-11-271-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Fix issue ActiveStorage direct upload diskGraham Conzett2018-10-071-0/+10
| | | | | | 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/+8
| | | | | | `ActiveStorage::DiskController#show` generates a 404 Not Found response when the requested file is missing from the disk service. It previously raised `Errno::ENOENT`.
* Restore inadvertently-removed fallbackGeorge Claghorn2018-07-151-0/+6
|
* Support HTTP Range downloads from diskGeorge Claghorn2018-07-151-2/+11
| | | | Closes #32193.
* Assert correct response bodyGeorge Claghorn2018-05-031-4/+6
|
* Always exclude JSON root from direct_uploads#create responseJavan Makhmali2018-04-101-0/+23
| | | | | | The JavaScript component expects a bare response. Fixes #32365
* Update test to reflect GCS direct upload header changeGeorge Claghorn2018-03-061-1/+1
|
* Merge Previews/Variants controller into one Representations controller.Kasper Timm Hansen2018-03-033-65/+61
| | | | | | | | | 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.
* Update test to reflect direct upload header changesGeorge Claghorn2018-02-261-1/+1
|
* Allow S3 tests against buckets in other regionsAndrew White2018-02-211-1/+1
| | | | | Only us-east-1 gives URLs like bucket.s3.amazonaws.com whereas other regions have URLs like s3-eu-west-1.amazonaws.com/ubxd-rails
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-1/+1
|
* Handle invalid signed blob IDs gracefullyGeorge Claghorn2017-12-153-0/+23
|
* Preview PDFs and videosGeorge Claghorn2017-09-283-3/+27
|
* Encode Content-Disposition filenames according to RFC 2231George Claghorn2017-08-211-2/+2
| | | | Closes #30134.
* DRYGeorge Claghorn2017-08-201-2/+2
|
* Should escape regexp wildcard character `.`Koichi ITO2017-08-142-2/+2
|
* Use frozen string literal in Active StorageKoichi ITO2017-08-124-0/+8
|
* Enable browser caching for blobs and variants (#30196)Anton Khamets2017-08-111-0/+15
|
* Fix ruby warningsyuuji.yaginuma2017-08-052-3/+3
| | | | | | | | | | This fixes following warnings: ``` test/models/variant_test.rb:11: warning: ambiguous first argument; put parentheses or a space even after `/' operator lib/active_storage/attached/macros.rb:63: warning: instance variable @active_storage_attached_highlights not initialized lib/active_storage/attached/macros.rb:25: warning: instance variable @active_storage_attached_avatar not initialized ```
* Rename Azure to AzureStorage (#30057)Dino Maric2017-08-041-2/+2
|
* Fix tests for AWS buckets that include a . (#30059)Claudio B2017-08-041-1/+2
| | | | | | | | | If an AWS bucket name includes a `.` (e.g. `bucket.name`), then the canonical URL for an object will start with "https://s3.amazonaws.com/bucket.name/" and not with "https://bucket.name.s3.amazonaws.com/". The URL tests have now been separated into two separate asserts, to ensure that both the "s3.amazonaws.com" and the "bucket.name" components are included, but not specifically in that order.
* Skip if credentials aren't providedDavid Heinemeier Hansson2017-08-011-1/+1
|
* Add 'activestorage/' from commit '3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58'Rafael Mendonça França2017-07-313-0/+199
git-subtree-dir: activestorage git-subtree-mainline: 0d58e7e478e79c2d6b2a39a4444d2a17a903b2a6 git-subtree-split: 3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58