aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app
Commit message (Collapse)AuthorAgeFilesLines
* It may be better to explicitly require 'object/try' where we call `try`Akira Matsuda2019-08-011-0/+2
| | | | | | In most cases it works now without explicit require because it's accidentally required through active_support/core_ext/date_and_time/calculations.rb where we still call `try`, but that would stop working if we changed the Calculations implementation and remove the require call there.
* Mirror direct uploadsGeorge Claghorn2019-05-223-1/+21
|
* Inline anemic methodsGeorge Claghorn2019-05-151-10/+4
|
* normalize the hash of transformationsYi Feng2019-04-201-1/+1
|
* url -> URL where apt except inside actionpack/Sharang Dashputre2019-04-011-1/+1
|
* Revert "Add ActiveStorage.service_configurations and ActiveStorage.service"George Claghorn2019-03-311-1/+1
| | | | This reverts commit 002684e36e813469c3585e193f0698784c88278b.
* Add ActiveStorage.service_configurations and ActiveStorage.serviceGeorge Claghorn2019-03-311-1/+1
| | | | | | * Allow plugins to access the global service and alternative service configs before ActiveStorage::Blob loads. * Make ActiveStorage.service_configurations the default second argument to ActiveStorage::Service.configure. Plugins that just want to use an alternative service defined in config/storage.yml needn't pass in the config themselves.
* Add load hook for ActiveStorage::AttachmentGeorge Claghorn2019-03-282-2/+4
|
* Add ActiveStorage::Service#openGeorge Claghorn2019-03-281-4/+5
|
* Squish the deprecation messages across the codebasePrathamesh Sonpatki2019-03-111-1/+1
| | | | | | | | | | | | | | | | Sample example -> Before: prathamesh@Prathameshs-MacBook-Pro-2 blog *$ rails server thin DEPRECATION WARNING: Passing the Rack server name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -u option instead. After: prathamesh@Prathameshs-MacBook-Pro-2 squish_app *$ rails server thin DEPRECATION WARNING: Passing the Rack server name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -u option instead.
* Prefer ImageProcessing's resize_to_limit macro over resize_to_fitGeorge Claghorn2019-01-244-11/+11
| | | | Don't upsize images smaller than the specified dimensions.
* Revert ensure external redirects are explicitly allowedGannon McGibbon2019-01-222-2/+2
|
* Fix ArgumentError: Unsafe redirectYuichi Takeuchi2019-01-212-2/+2
|
* Permit sending Active Storage purge and analysis jobs to separate queuesGeorge Claghorn2019-01-013-1/+4
|
* Make Active Storage blob keys lowercaseJulik Tarkhanov2018-12-301-3/+13
| | | Accommodate case-insensitive filesystems and database collations.
* Don’t include an undefined X-CSRF-Token headerCameron Bothner2018-12-272-2/+10
| | | | | | | If there is not a `csrf-token` meta tag in the document, the blob record XHR was including an `X-CSRF-Token` header set to the string "undefined." Instead of setting it to undefined, it should not be included in the absence of a meta tag.
* Fix minor Active Storage docs typo [ci skip]Adrian Hawrylak2018-11-281-1/+1
|
* Prevent content type and disposition bypass in storage service URLsRosa Gutierrez2018-11-273-5/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* ASt direct uploads: account for <button type="submit"> elementsTasos Maschalidis2018-11-242-4/+4
|
* update activestorage attachment model documentation reflect recent behavior ↵Kyle Keesling2018-10-241-3/+2
| | | | changes
* 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.
* Merge pull request #33829 from mtsmfm/encode-filenameKasper Timm Hansen2018-09-232-42/+0
|\ | | | | Encode Content-Disposition filenames on send_data and send_file
| * Encode Content-Disposition filenames on send_data and send_fileFumiaki MATSUSHIMA2018-09-132-42/+0
| |
* | Raise `ActiveRecord::InvalidForeignKey` in `before_destroy` for a blob if ↵bogdanvlviv2018-09-161-0/+4
|/ | | | | | | | | | | | | | | attachments exist The issue #32584 was fixed in #33405 by adding foreign key constraint to the `active_storage_attachments` table for blobs. This commit implements fix on app-level in order to ensure that users can't delete a blob with attachments even if they don't have the foreign key constraint. See a related discussion in the Campfire: https://3.basecamp.com/3076981/buckets/24956/chats/12416418@1236718899 Note that, we should backport it to `5-2-stable` too. Related to #33405
* Fix zero-byte files uploadMarcelo Perini Veloso2018-09-061-1/+5
|
* Merge pull request #33666 from ↵George Claghorn2018-08-221-0/+2
|\ | | | | | | | | cbothner/fail-gracefully-from-activestorage-file-not-found Fail more gracefully from ActiveStorage missing file exceptions
| * 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`.
* | activestorage: yarn buildbogdanvlviv2018-08-191-4/+4
| | | | | | | | Context https://github.com/rails/rails/pull/33413#issuecomment-414137587
* | Retry ActiveStorage::AnalyzeJobs on download integrity check failuresGeorge Claghorn2018-08-191-0/+2
| |
* | Enable multiple submit buttons for Active Storage formsChris Seelus2018-08-182-2/+22
|/
* Extract ActiveStorage::SetCurrentGeorge Claghorn2018-08-162-5/+18
| | | | Provide a handy concern for custom Active Storage controllers that can't inherit from ActiveStorage::BaseController.
* Extract transformersGeorge Claghorn2018-08-102-70/+19
|
* DRY up web image checks in ActiveStorage::VariantGeorge Claghorn2018-08-091-18/+24
|
* Retry ActiveStorage::PurgeJobs on DB deadlockGeorge Claghorn2018-07-311-0/+1
|
* Guard against missing blobs caused by concurrent purgesGeorge Claghorn2018-07-301-3/+3
|
* Clarify conditionGeorge Claghorn2018-07-271-1/+1
| | | | && binds tighter than || in JavaScript, but we ought not expect readers to remember language trivia.
* Fix directly uploading zero-byte filesGeorge Claghorn2018-07-272-2/+2
| | | | Closes #33450.
* Ignore ActiveRecord::InvalidForeignKey in ActiveStorage::Blob#purgeJasper Martin2018-07-262-1/+2
| | | Do nothing instead of raising an error when it’s called on an attached blob.
* Discard ActiveStorage::PurgeJobs on ActiveRecord::InvalidForeignKeyGeorge Claghorn2018-07-201-1/+1
|
* Delete attachment before purging blobGeorge Claghorn2018-07-191-2/+2
|
* Destroy blob record before deleting stored dataGeorge Claghorn2018-07-191-1/+1
|
* Link between ActiveStorage::Blob#purge, #purge_later, and #delete [ci skip]George Claghorn2018-07-181-5/+5
|
* Clarify the ActiveStorage::Attachment#purge and #purge_later docsGeorge Claghorn2018-07-181-2/+2
| | | | Link to the corresponding ActiveStorage::Blob methods, whose docs more accurately describe their effects. [ci skip]
* Restore inadvertently-removed fallbackGeorge Claghorn2018-07-151-1/+2
|
* Support HTTP Range downloads from diskGeorge Claghorn2018-07-151-14/+15
| | | | Closes #32193.
* Discard ActiveStorage::PurgeJobs for missing blobsGeorge Claghorn2018-07-111-0/+2
|
* Remove overly-broad retry in ActiveStorage::PurgeJobGeorge Claghorn2018-07-111-3/+0
| | | | We've never intentionally tripped this retry in production. Add retries for specific errors as needed.
* Store newly-uploaded files on save rather than assignmentGeorge Claghorn2018-07-072-10/+29
|
* Permit configuring the default service URL expiryGeorge Claghorn2018-06-214-5/+5
|