discourse/lib/tasks
Martin Brennan 7c32411881
FEATURE: Secure media allowing duplicated uploads with category-level privacy and post-based access rules (#8664)
### General Changes and Duplication

* We now consider a post `with_secure_media?` if it is in a read-restricted category.
* When uploading we now set an upload's secure status straight away.
* When uploading if `SiteSetting.secure_media` is enabled, we do not check to see if the upload already exists using the `sha1` digest of the upload. The `sha1` column of the upload is filled with a `SecureRandom.hex(20)` value which is the same length as `Upload::SHA1_LENGTH`. The `original_sha1` column is filled with the _real_ sha1 digest of the file. 
* Whether an upload `should_be_secure?` is now determined by whether the `access_control_post` is `with_secure_media?` (if there is no access control post then we leave the secure status as is).
* When serializing the upload, we now cook the URL if the upload is secure. This is so it shows up correctly in the composer preview, because we set secure status on upload.

### Viewing Secure Media

* The secure-media-upload URL will take the post that the upload is attached to into account via `Guardian.can_see?` for access permissions
* If there is no `access_control_post` then we just deliver the media. This should be a rare occurrance and shouldn't cause issues as the `access_control_post` is set when `link_post_uploads` is called via `CookedPostProcessor`

### Removed

We no longer do any of these because we do not reuse uploads by sha1 if secure media is enabled.

* We no longer have a way to prevent cross-posting of a secure upload from a private context to a public context.
* We no longer have to set `secure: false` for uploads when uploading for a theme component.
2020-01-16 13:50:27 +10:00
..
add_topic_to_quotes.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
admin.rake FEATURE: Adds a message when the passwords doesn't match in rake admin:create (#8543) 2019-12-13 11:40:33 +11:00
api.rake FEATURE: Hash API keys in the database (#8438) 2019-12-12 11:45:00 +00:00
assets.rake DEV: Drop uglifyJS V2 support 2019-12-04 15:58:38 -03:00
auto_annotate_models.rake DEV: Automatically annotate plugin models alongside core models 2019-05-13 16:37:47 +01:00
autospec.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
avatars.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
backfill.thor DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
build_test_topic.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
build.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
categories.rake REFACTOR: Cleanup rake tasks based on feedback 2019-07-18 19:15:01 -06:00
cdn.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
db.rake DEV: correct parallel specs rake tasks 2019-12-31 14:07:55 +11:00
destroy.rake REFACTOR: Cleanup rake tasks based on feedback 2019-07-18 19:15:01 -06:00
docker.rake DEV: Prevent plugin loading when running core db migrations in tests 2019-12-10 16:11:49 +00:00
emails.rake FIX: POP3 doesn't work with TLS 1.3 2019-09-11 18:43:19 +02:00
emoji.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
export.rake FIX: Correct path to ImportExport module (#8227) 2019-10-23 17:27:14 +11:00
groups.rake Make rubocop happy. 2019-05-13 09:55:44 +08:00
i18n.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
images.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
import.rake Reference posts table for deleted_at and user_id (#8332) 2019-11-11 11:03:57 -05:00
incoming_emails.rake FEATURE: Remove attachments and truncate raw field for incoming emails (#8253) 2019-10-30 16:54:35 +11:00
integration.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
javascript.rake FEATURE: Make Discourse work offline with WorkboxJS (#7870) 2019-07-15 13:05:55 -03:00
maxminddb.rake FIX: maxminddb:get task no longer working 2019-10-04 09:47:33 +10:00
plugin.rake Rename lazyYT plugin directory name to lazy-yt 2019-08-21 14:35:14 +05:30
populate.thor DEV: prevents populate task to crash (#8111) 2019-09-22 05:18:48 -07:00
posts.rake DEV: pluck_first 2019-10-21 12:08:20 +01:00
qunit.rake DEV: Allow CSP to be enabled during QUnit tests (#8668) 2020-01-07 12:22:58 +00:00
redis.rake DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
release_note.rake Fix release notes rake task 2019-12-05 11:53:10 -05:00
rspec.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
s3.rake DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
scheduler.rake FIX: DistributedMutex (#7953) 2019-08-01 09:12:05 +01:00
search.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
site_settings.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
smoke_test.rake DEV: Add env variable to allow easier debugging of smoke tests 2019-10-24 17:48:15 +02:00
svg_icons.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
tags.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
themes.rake FEATURE: Rake themes installer (#7848) 2019-07-04 14:33:05 -04:00
topics.rake FEATURE: Add support for secure media (#7888) 2019-11-18 11:25:42 +10:00
turbo.rake DEV: Add a verbose option to ./bin/turbo_rspec 2019-06-27 15:49:21 +01:00
typepad.thor DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
uploads.rake FEATURE: Secure media allowing duplicated uploads with category-level privacy and post-based access rules (#8664) 2020-01-16 13:50:27 +10:00
user_actions.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
users.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00