Commit Graph

72 Commits

Author SHA1 Message Date
Jacob Burroughs 0b11a06005 Allow invoking the garbage collector with delay
Change-Id: Ibe8a9b512b040492fbff6315746e901bc87b655d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/331714
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2023-10-31 18:43:46 +00:00
Jacob Burroughs dca1218318 Improve garbage collector query performance
Also improve deletion performance by deleting in parallel

Change-Id: I38c13e543f0f962b5361b3a612882bc44067f3eb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/328121
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Alex Slaughter <aslaughter@instructure.com>
2023-09-21 20:31:53 +00:00
Jacob Burroughs 02ade49370 Fix assorted attachment garbage collector bugs
Change-Id: Ia2cdaaf9159d19fb7827e4a59bc2327d393429d6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327038
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2023-09-06 18:10:13 +00:00
Isaac Moore fe52f62dae Fix redundant merge linter violation
refs AE-57
flag=none

Change-Id: I864fe0d0e714a4af2a856e99fc67f53a05c649dd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/326678
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2023-08-31 16:10:26 +00:00
Isaac Moore f1fb46e61c Include session token in S3 local upload params
refs AE-57
flag=none

test plan:
- uploading with an assumable vault role works
- uploading with static IAM creds works

Change-Id: I509f479a01db975c3ac233b7569a54af1aefd919
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/326675
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Isaac Moore <isaac.moore@instructure.com>
2023-08-31 15:56:13 +00:00
Isaac Moore fbaf55e924 Fix local S3 uploads not working with Vault roles
refs AE-57
flag=none

test plan:
- local uploads work with Vault roles for S3
- local uploads work with static creds for S3

Change-Id: I0c367f21f214b2f7614385798524af7b202acce0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/326460
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
2023-08-30 16:04:47 +00:00
Jacob Burroughs efaac42207 Greatly improve attachment garbage collector performance
refs AE-441

Change-Id: If0b0cbc8a684020780e0d66d0d955b911d57fec5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/325931
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2023-08-23 22:16:10 +00:00
Jacob Burroughs 7dcc507d0a Rubocop for ruby 3.1
[skip-stages=Flakey]

Change-Id: I6abefdfa9fed6dd4525c8786e93efa548b3710f2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/319603
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2023-06-06 16:44:26 +00:00
Mysti Lilla 2f82283ebf Mark instfs file uploads as processed
The after save processes for media files
were reuploading the lowest quality version
of the file, because instfs wasn't marking
the file as uploaded.  This resolves that.

fixes MAT-1350
flag=none
qa-risk: low

Test plan
- Have notorious running
- Set up instfs (ask me if you need help)
- Upload a media file and wait a few minutes
  to make sure the media id is populated in
  the file you just uploaded
- Verify that you can download the file at
  its original size

Change-Id: Id0f29165000513284961c7c7fde08cf87e9892d2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/317827
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Juan Chavez <juan.chavez@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2023-05-11 17:26:01 +00:00
Jeremy Stanley 7959d416a3 don't fail integrity_check when md5 is missing (local/s3)
test plan:
 - with a local or S3 (not InstFS) file, opened in Rails console
   with .open(integrity_check: true)
   - should work if the md5 is present and correct
   - should raise a CorruptedDownload if the md5 is incorrect
   - should work if the md5 is missing

flag=none
closes gh-2147
closes FOO-3360

Change-Id: Ibe1c65af8f618343cdc399217c30d15bb1f53ca9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/310294
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2023-02-04 16:57:08 +00:00
Jeremy Stanley c4b4b94573 fix Attachment marshalling bug
the `md5` attribute should store a hex digest and not the Digest
object iself. the latter works after type cast but prevents the
Attachment from being marshaled before reloading, resulting in
"no _dump_data is defined for class Digest::SHA512"

test plan: specs
fixes FOO-3306

Change-Id: I34d540bb6f110cf43d3ab68436277caf0d024db4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/309972
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2023-01-31 00:02:34 +00:00
Mysti Lilla 36cb569bb7 Files mimetype clean up
refs MAT-1091
flag=none

[fsc-timeout=30]

Test plan
- Specs pass

Change-Id: Iac01fda45b271340fed69c57b9647a1240367171
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/309298
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2023-01-27 22:12:15 +00:00
August Thornton 8fc215a23f return false if verifier is not of a supported type
fixes FOO-3295
flag = none

test plan:
• request a file preview of a specific course file i.e.
/courses/43511/files/271828/file_preview?verifier[%24acunetix]=1
• it shouldn't blow up, but instead will fail to pass verification

Change-Id: If959c259e03e0d4931fbfa3ae2262cc964f86ef7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308247
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2023-01-06 17:38:20 +00:00
Jeremy Stanley 19f8fe077c validate hash on streaming download
test plan:
 - modify the md5 column of an existing Attachment
 - download it with Attachment#open and
   pass `integrity_check: true`
 - a CorruptedDownload exception should be raised
   and the hash mismatch should be logged in an ErrorReport

flag=none
refs FOO-3256

Change-Id: I035d46cd4e44bd179d0943497147d6cc63ef3b9d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306879
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Sean Scally <sean.scally@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-12-15 18:20:10 +00:00
Jeremy Stanley 24bf449734 remove need_local_file option from Attachment#open
it doesn't do anything. we always download a file locally unless
a block is given to #open, and places exist that call #open
without the option and still depend on the local file being there

replace opts with keyword arguments while we're at it.

test plan: specs

flag=none
refs FOO-3256

Change-Id: I52461022cef457b85ab2f270f7d22d358617c786
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306971
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-12-09 22:25:37 +00:00
Aaron Ogata a635cfafdc fix syntax for ruby 3.x
refs AE-92

Change-Id: I32c404212d5d0f4cfe8d7b4af01aebf0e1952e96
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307065
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
2022-12-09 18:56:47 +00:00
Ethan Knapp feafc09667 add file permissions
adds a Course-level setting to control the visibility of uploaded files
also adds a per-file setting to override the Course-level setting

Test Plan:
1. Validate the the Course-level setting can be set and updated. It should
    behave similar to the Syllabus visibility setting, but should allow
    being looser or tighter than the Course itself.
2. Validate that the File-level setting can be modified.
3. Validate that Files can only be accessed based on the setting.
4. Validate that the existing "Only with link" and "Schedule availability
    rules work as expected with the new options.

flag = none
refs PFS-20427

[fsc-max-nodes=20]
[fsc-timeout=45]

Change-Id: Ie688264fff59e81b13c97ef58bf0ae81cf8a5610
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/300000
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Douglas Rist <douglas.rist@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2022-09-26 22:51:46 +00:00
Luis Oliveira 50515ff9bd Stop duplicating files on repeat cartridge imports
fixes LS-2897
flag=none

test plan:
- Have the INST-FS plugin ON
- Have a canvas export package with at least one file
- Import the export package into a fresh course
- Import the same export package again.
- Check that the file wasn't duplicated
- (You could, after the first import, alter the
  attachment md5 column and put it's sha512 there,
  then theorically you'd be testing this, but Ideally
  you want instfs ON)

Change-Id: I0de79032d2ccd64e51cc09dea61b410aad43756f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282779
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Luis Oliveira <luis.oliveira@instructure.com>
2022-02-03 15:07:56 +00:00
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer e73cf9ddf4 RuboCop: Style/HashSyntax
[skip-stages=Flakey]

auto-corrected

Change-Id: I9371a61046aee6b148f89dd434114a8ba2b1188c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279533
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:02:35 +00:00
Cody Cutrer eaca556b81 RuboCop: Style/NumericLiterals
[skip-stages=Flakey]

auto-corrected

Change-Id: I88363d87d5a70be941aa81b4ffe5306ce7506b98
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279207
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:31:34 +00:00
Cody Cutrer c6b267e12b RuboCop: Rails/Delegate
auto-corrected, with a bit of manual massaging afterwards if there were
multiple delegations to the same object to combine them into a single
call

Change-Id: Ic93ccad26b037e1f89874d36f9759e5c34435892
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278965
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-19 22:42:26 +00:00
Cody Cutrer 028e744bdc RuboCop: Style/ClassCheck, Style/ClassEqualityComparison
[skip-stages=Flakey]

auto-corrected

had to rework some instfs to play nice with stubs in its specs

Change-Id: I894831c6503095c6b197154e39fe17e803702d9c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278785
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-19 22:39:31 +00:00
Cody Cutrer 3512a9557e RuboCop: Style/SafeNavigation
[skip-stages=Flakey]

auto-corrected

Change-Id: I0a907a6fa6229f05b4f756faf53a8dd2b18ea0c5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278213
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-16 06:36:38 +00:00
Cody Cutrer e50edd485f RuboCop: heredocs
[skip-stages=Flakey]

Naming/HeredocDelimiterNaming and Rails/SquishedSQLHeredocs

the former was manual, the latter was automatic. I also changed
some <<- to <<~ to allow for better formatting

I also had to change comments inside squished SQL heredocs to
be block comments (since newlines are removed); searching for those
I found some multi-line strings that are better as heredocs

Change-Id: I6b138f8e32544b97df1e4c56f09ee5316cbdef9d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278184
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-16 06:36:00 +00:00
Cody Cutrer a690e90aa8 RuboCop: Style/RedundantReturn
[skip-stages=Flakey]

auto-corrected

Change-Id: Ic472ca1cc04423fc966cd4a1ead467604d2904fc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278130
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-12 16:33:45 +00:00
Cody Cutrer 299314b162 RuboCop: Style/NegatedIf
auto-corrected

Change-Id: Ieab0b9525c1342f900721196c6694bef17378ec0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278024
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-11 22:55:11 +00:00
Cody Cutrer a498023706 RuboCop: Performance/StringReplacement
auto-corrected

Change-Id: I4df9529bd8d09d9f96e979d59120f126fe2b8761
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278006
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-11 22:00:48 +00:00
Cody Cutrer aee91b708e RuboCop: Lint/UnusedMethodArgument app/models
all manual

several instances I noticed that the entire method was unused, so removed it

Change-Id: I14ffe7d4b6966ee790e32410f1dbaf5b26ea7f21
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276513
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-10-27 15:55:26 +00:00
Cody Cutrer a6122225be Revert "Revert "RuboCop: update to 1.22.0""
This reverts commit eb44849fd6.

Reason for revert: apt repo is no longer broken

Change-Id: I9224768d117e1b1a030f881ec03e0295afcb73d9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274305
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-10-01 17:39:09 +00:00
Aaron Ogata eb44849fd6 Revert "RuboCop: update to 1.22.0"
This reverts commit 3fdd418bc0.

Reason for revert: Jenkins broke

Change-Id: I981c14d5db293289c40576bd425c25d1933c1935
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274304
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
2021-09-30 14:57:30 +00:00
Cody Cutrer 3fdd418bc0 RuboCop: update to 1.22.0
* Layout/DotPosition now handles heredocs (auto-correct, including
   cascading layout fixes)
 * Lint/AssignmentInCondition now ignores assignments-in-blocks-in
   conditions, so can remove explicit disabling

Change-Id: I476c0d54cf6d38fc3b009d7057f7e6082465240d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274756
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-30 13:38:20 +00:00
Cody Cutrer dbd8c46655 RuboCop: Lint
[skip-stages=Flakey]

auto corrections applied:
 * Lint/AmbiguousOperator
 * Lint/AmbiguousOperatorPrecedence
 * Lint/AmbiguousRegexpLiteral
 * Lint/DeprecatedClassMethods
 * Lint/DeprecatedOpenSSLConstant
 * Lint/NonDeterministicRequireOrder
 * Lint/ParenthesesAsGroupedExpression
 * Lint/RedundantRequireStatement
 * Lint/RedundantSafeNavigation
 * Lint/RedundantSplatExpansion
 * Lint/RedundantStringCoercion
 * Lint/RedundantWithIndex
 * Lint/SendWithMixinArgument
 * Lint/SymbolConversion

Change-Id: I222ec19978033544513bb99755994d109435abad
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274551
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-29 03:38:23 +00:00
Cody Cutrer f5cdb0d986 RuboCop: Layout app/models
Change-Id: Ieae2904fb81739476d806b01bd7b4ff98c5ee35c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274155
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-22 19:32:32 +00:00
Jacob Burroughs af790ddb0f Improver verifer verification
fixes FOO-2118

Change-Id: I83aa0a3d54e18fb09f1ebf60cd9d1e8d5b13cdeb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268935
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-07-13 20:40:47 +00:00
Cody Cutrer 992cabf3ac restore accidentally lost in_batches chain
Change-Id: If4497ce5615011f9038d85b1ab76945db812e57f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268465
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-07-06 19:54:52 +00:00
Cody Cutrer 3025cdbe42 Revert "Revert "re-implement in_batches and friends""
This reverts commit 2c5c3584ff.

Reason for revert: I'm back in the office and can debug the problems

Change-Id: Ib469fff450a8d51d7ca59cb9d7fa29874d6b6e53
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268386
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-07-06 19:54:25 +00:00
Jacob Burroughs 2c5c3584ff Revert "re-implement in_batches and friends"
This reverts commit 230033611d.

Reason for revert: COPY strategy is broken

Change-Id: I2cb4e5430c180caa1ceae6570d27a4c86a12d704
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/267654
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-07-02 16:52:51 +00:00
Cody Cutrer 230033611d re-implement in_batches and friends
* do everything as in_batches, returning a relation. properly
   super `load` param in each backend
 * plumb strategy through all entry points so it can be explicit
 * special case in_batches.delete_all with no explicit strategy to
   do a loop on a limited delete_all (avoids a dumb ORDER BY, or
   having to transfer ids back and forth)
 * since in_batches can easily be used with pluck now that a relation
   is returned, just make find_in_batches_with_temp_table a shim that
   does it the "nice" way

Change-Id: I716f188cdf676a725588f94a1036981ae798b09c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/266882
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-06-21 21:28:07 +00:00
Jeremy Stanley 2db8de77d6 allow related attachment UUID to be used as verifier
this is intended to mitigate an issue where the source
verifier remains in the URL after a course copy

test plan:
 - have a course wiht a file
 - copy the course
 - as an unauthenticated user, construct a URL to the new
   course's copy of the file with the old course's file's uuid
   as a verifier, i.e.
   /courses/2/files/2/download?verifier=`file1.uuid`

refs LS-2225

Change-Id: Id7e61e2baa817b25f83cc125843ace70a5bf0497
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265196
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-05-20 20:14:03 +00:00
Ethan Vizitei 6816e36902 pull canvas::security out into a gem
refs FOO-1648
flag=none
[fsc-propagate=false]

move general module code to "gems"
along with specs.

Leave shim in canvas to avoid breaking
things while callsites get changed.

change some limited callsites
from Canvas::Security to CanvasSecurity
that were doing spec stubbing that required
at least one namespace change anyway

generate readme describing common use
cases.

TEST PLAN:
  1) security operations continue unimpeded.

Change-Id: Ia2d102d5038e2f5d0bb24201e38894e12b73063e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259540
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-02 20:58:55 +00:00
Cody Cutrer f299f76b75 add # frozen_string_literal: true for models
Change-Id: I70825be7ec7e24458afe0c63dc48c5a76158f520
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251150
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-28 22:08:12 +00:00
August Thornton f52a577a58 remove AuthenticationMethods#load_pseudonym_from_policy
The two occurrences I found were `prepend_around_action`,
which prepends a callback around actions. The two actions
associated with this callback are no longer being used. Therefore
there was no evidence pointing to a callsite for
AuthenticationMethods#load_pseudonym_from_policy.

The files controller appears to call a new action `api_create`
vs the old :create. This handles the policy via its new code-path.

The content imports controller referenced a "migrate_content_upload"
action that is no longer in commission.

It appears the original intent behind the usage was for flash file
uploads. Usage existed in local_storage.rb & s3_storage.rb

[skip-cache]

refs FOO-1085
refs https://gerrit.instructure.com/c/migration_tool/+/251170
flag = none

test plan:
 - specs pass
 - bulk course migrations still work

Change-Id: Iedd0ff846e13840ce1c33f4da27b29ddd30f87ae
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250591
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2020-10-27 14:56:32 +00:00
Jeremy Stanley 7c2fcc3542 use squiggly heredocs for SQL
to avoid sending unnecessary whitespace to the database

test plan: specs

closes LS-1422

Change-Id: Iaaa73059b46964d4c51e920fd469b876256ec632
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246811
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2020-09-04 19:11:47 +00:00
Ethan Vizitei fbccf37a00 lets not renamespace the store if instfs has the file
Change-Id: I6814fd333fed7b39b4c5dbffc8c5373651fd8a96
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235712
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-04-30 15:47:54 +00:00
Mysti Lilla 25b9eb099e Create model for direct share
closes ADMIN-2808
flag=direct_share

Test plan
- n/a

Change-Id: I1481e273b76bf969ce8e3a510702bfa1f11fb0d7
Reviewed-on: https://gerrit.instructure.com/204282
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: Mysti Lilla <mysti@instructure.com>
2019-08-20 15:50:18 +00:00
Rob Orton 04e7bf8cb8 use inst_statsd
fixes CORE-2538

test plan
 - configure statsd to use data dog
 - it should work

Change-Id: Ie8428e4e99973b35506bd7a8e4d1a18f5a7875a1
Reviewed-on: https://gerrit.instructure.com/182083
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2019-03-25 17:00:49 +00:00
Michael Jasper 56216b0083 Fix submission download size bug
fixes RECNVS-383

test plan
- as a student: upload a file as an assignment submission
- as a teacher: download the zip of student submissions
- verify that the correct download size is show in the download modal

Change-Id: I26a5cf40e2181fa8626f77bc73d2da441009c135
Reviewed-on: https://gerrit.instructure.com/144564
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins
Product-Review: Michael Jasper <mjasper@instructure.com>
2018-03-26 16:11:36 +00:00
Michael Jasper 816c4bad2d Upload attachment to inst-fs, eportfolio export
closes RECNVS-362
closes RECNVS-363

Test plan:
- with instfs configured and enabled:
  - log into canvas and navigate to the users eportfolio
  - dowload the eportfolio
  - verify that the eportfolio was
    - created successfully
    - download from the <instfs domain>/files
  - verify that the instfs logs show
    - a post of the eportfolio to instfs
    - a get of the eportfolio from instfs

Change-Id: Ia27ca9811598cea180432e730ae8d5163a720036
Reviewed-on: https://gerrit.instructure.com/143050
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Michael Jasper <mjasper@instructure.com>
2018-03-21 19:45:35 +00:00
Simon Williams 07a3f31363 attachment gc improvements + support ContentMigration
fixes CORE-58

test plan:
- successfully deletes old ContentMigrations, including those tied to
old ContentExports

Change-Id: Ib9ca545da8a6929f495317bba08d0103acbaf1cc
Reviewed-on: https://gerrit.instructure.com/143330
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2018-03-19 15:36:17 +00:00