Commit Graph

26 Commits

Author SHA1 Message Date
Cody Cutrer 06763dd519 add # frozen_string_literal: true for lib
Change-Id: I59b751cac52367a89e03f572477f0cf1d607b405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251155
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>
2020-10-27 20:49:50 +00:00
Ethan Vizitei 98bfcba24c stop yaml_cache pollution
fixes CNVS-49087
flag = none

implement deep freezing
for the config values to
stop the pollution

dup all the locations
where the config is either
modified or passed off to
some other library where
it's not clear it was loaded
from a frozen config file

TEST PLAN:
 1) load a config file
 2) try to change it's key/vals
 3) you can't because it's frozen

Change-Id: I15faa230e3c99fe4806154493e238cecec526d1a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236341
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-05-07 18:55:05 +00:00
Simon Williams affa953f61 drop Message#asset_context and DelayedNotification#asset_context
name did not match usage, and all remaining usage can be satisfied in
other ways.

closes CNVS-38407

test plan: regression test message sending (immediate, delayed, and
dashboard notifications w/ stream items)

Change-Id: Ibe110527b4644cbaa417c53b2b53c2fd7e18dc9e
Reviewed-on: https://gerrit.instructure.com/120520
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Reviewed-by: Matt Smith <msmith@instructure.com>
Reviewed-by: Benjamin Christian Nelson <bcnelson@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2017-08-22 17:47:51 +00:00
Landon Wilkins e08cd0c241 da licença part 30
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: I13ce64f5dea44b41fe32c7c4b2ee1e31c0878c85
Reviewed-on: https://gerrit.instructure.com/110055
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 21:59:55 +00:00
Strand McCutchen d6597c107c fix Style/EmptyLineBetweenDefs issue
Change-Id: Ib7b824043a7ac9196f06020e2ca42fe983565f0d
fixes: CNVS-20009
Reviewed-on: https://gerrit.instructure.com/52919
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
2015-04-29 16:28:39 +00:00
Cody Cutrer 8178266194 split yaml file loading out of Setting
refs CNVS-13024

Setting wasn't properly being initialized as unsharded because
it was loading before Switchman. The reason we need Setting before
switchman is just for yaml loading, so split that into its own
class.

Change-Id: I5456e103cb216dba2d5af4e9c20a697b468c923b
Reviewed-on: https://gerrit.instructure.com/35043
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-05-21 18:27:06 +00:00
Cody Cutrer 66238994d0 spec: fix specs with a plugin that overrides HostUrl.file_host_with_shard
test plan:
 * specs should pass

Change-Id: I3abada3fd0d04d9e3298ee9a852d65421d22622b
Reviewed-on: https://gerrit.instructure.com/15271
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-11-12 15:50:46 -07:00
Cody Cutrer c1a08e7119 generate safe file urls relative to the shard of the files domain
allows it to be a different shard than where the file is. I had
to remove type casting from dynamic finders that don't know how
to deal with non-integral global ids.

also cache s3 urls on the same shard as the attachment

test plan:
 * have multiple shards and S3 storage
 * have a single safe files domain
 * you should be able to upload and download files in all shards
 * verify that it's going against the files domain, not the normal
   domain

Change-Id: I2b498fc1df20d5b43bf20f702580451621eeaf6a
Reviewed-on: https://gerrit.instructure.com/15158
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-11-12 09:17:37 -07:00
Jon Jensen 8dcdacad37 fix development fallback images for gravatar
gravatar has started proxying fallback images, which breaks things if the
host is localhost or something not publicly accessible. set fallback host
to canvas.instructure.com in dev and selenium environments (w/ a
mechanism to override it).

test plan:
1. run canvas locally
2. gravatar fallback images should work again
3. run canvas in beta/production
4. gravatar fallback images should still work, and the url should have the
   current hostname in the proxy path (e.g.
   https://i1.wp.com/foobar.instructure.com/images/.. )

Change-Id: Idfd2129e0d78026b2bcfd57e8c7399e0b29f8a3a
Reviewed-on: https://gerrit.instructure.com/14245
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-10-10 09:10:36 -06:00
Brian Palmer 70639150ba api: translate absolute paths to full urls with the canvas host
This fixes image links to /equation_images/X, among other things.

As part of this, I refactored the attachment.rb secure setting to be a
domain.yml (HostUrl) setting that can be used app-wide to determine
whether to use http or https when the code doesn't have access to a Request.

Fixes #8784

I also started down the road of having notification emails/sms/etc use
https links instead of http, but there is still work to do there, refs #9190

test plan: Use the rich text editor to post to a discussion or any other
rich text field that can be retrieved via the api, and include an
equation using the equation editor. Then retrieve that post through the
api, and verify that the url to the equation image includes the canvas
hostname and protocol (http://canvas.example.com/equation_images/X
instead of just /equation_images/X)

Change-Id: Iac28bf99d2d3b33c17d5b3eb128aa6d8488570fe
Reviewed-on: https://gerrit.instructure.com/11867
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-07-02 09:53:59 -06:00
Cody Cutrer 3f4fb02712 support listing multiple domains in saml metadata fixes #6859
test plan:
 * ensure saml metadata is unchanged

Change-Id: I5d7e82a7fdf936492bbc2d044999d3bdad01620f
Reviewed-on: https://gerrit.instructure.com/9863
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2012-04-18 15:13:58 -06:00
Cody Cutrer 42f0b97527 pass host not account domain to context_host refs #6859
test plan:
 * ensure specs pass

Change-Id: I0ce287218b09dc7d03242e09354749020b7044a6
Reviewed-on: https://gerrit.instructure.com/9819
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2012-04-18 15:09:21 -06:00
Brian Palmer d0d91e0859 disallow object_snippet calls on non-safefiles domains
fixes #8079

test plan: with safefiles configured, embed an object tag for a swf file
in a user content field (like a discussion topic), and then view html
source to pull out the form that posts to /object_snippet, including the
canvas verified signature. make that same post to the main non-files
domain, and verify it's denied. verify that object_snippet is still
allowed if safefiles is not configured -- though someday that may
change.

Change-Id: I7e6ae37482ff0c022bd4797d6589ba9a433a2626
Reviewed-on: https://gerrit.instructure.com/9902
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-09 10:52:53 -06:00
Cody Cutrer f6192f0925 plumb current host to files_host calls
test plan:
 * ensure accessing files still works

Change-Id: I17a82158a39f0db24e67e59e7877b3f0bd0447d4
Reviewed-on: https://gerrit.instructure.com/9690
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-03-30 18:32:14 -06:00
Brian Palmer 1443dec982 reset HostUrl caches between specs
Change-Id: Ifc085199bd48fb3166c8b1def31f67244d464484
Reviewed-on: https://gerrit.instructure.com/6975
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-11-14 16:01:05 -07:00
Brian Palmer a2b972f1d8 partially revert "force domain.yml config in test env"
This doesn't play well with the selenium specs, which modify the test
env domain config when spawning a forked server.

This reverts the forced config, but keeps the domain_config refactoring.

Change-Id: I4ebf8983264adf99c37dd7097d28bdd1773bc2ec
Reviewed-on: https://gerrit.instructure.com/6169
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-10-13 11:43:27 -06:00
Brian Palmer cf3de519ff force domain.yml config in test env
tests fail if this config isn't what's expected, so it's silly to allow
changing it

Change-Id: Ib7f0bc1fe77ef85192b83de37db90f808be495cc
Reviewed-on: https://gerrit.instructure.com/6066
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-10-10 10:36:33 -06:00
JT Olds fbbdf75693 use the current account domain in context_host saml settings lookups
Change-Id: I53729d77055e8225583e612ca81fc578f948ff5f
Reviewed-on: https://gerrit.instructure.com/5965
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-10-05 15:59:57 -06:00
JT Olds d5c8be2ca0 allow for configuration of outgoing email name
Change-Id: I87587c291801f39697e8dd691d6be9b3b396b86b
Reviewed-on: https://gerrit.instructure.com/4746
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-07-21 13:33:16 -06:00
Zach Wily 12ba408bc7 be sure to initialize class vars in HostUrl
Change-Id: Ibdc3e24263b87f06f602243aa2dec7bf52015bfa
Reviewed-on: https://gerrit.instructure.com/4347
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-06-23 16:25:13 -06:00
Zach Wily 0bcf2dfd2c don't allow logins to the files domain; fixes #4726 and gh issue 23
Change-Id: Ia292e4c8a375e1eb61f812aed8d6fe8b3d83c901
Reviewed-on: https://gerrit.instructure.com/3914
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-06-22 16:10:54 -06:00
Brian Whitmer 2c5c268982 add twitter to notification preferences
Twitter recently stopped offering whitelist
exceptions for things like direct messaging.  We are
trying to work around the limitations by having
a user direct message themselves instead of having
some global account user that direct messages everyone.

Also added a "short_host" method for HostUrl that
in the future we can use to generate short-ish links
to include in tweets.  For now the links are somewhat
short, at least.

refs #4045

Change-Id: Iad59b979b166d572827a8ce16d3f9fcdd57d512d
Reviewed-on: https://gerrit.instructure.com/2938
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-06-14 11:57:48 -06:00
Brian Palmer d87c33d91d modify user_content strategy, fixes #3676
user_content will now work for any arbitrary RTE field, no matter if it
came from a column, a string nested three levels deep in a serialized
column, whatever.

let's call this technique "controlled XSS injection"

Change-Id: I56eed1f9b546ac7849dc60faa0f2b3801231131e
Reviewed-on: https://gerrit.instructure.com/3704
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-19 15:46:56 -06:00
JT Olds bedb1d878e fix default host for tests
Change-Id: I88b59c05a39803c95e3d306b9f47b7ef0450d4c8
Reviewed-on: https://gerrit.instructure.com/2429
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-02-24 17:11:18 -07:00
Brian Palmer 17b89a1751 add support for using sendmail for outgoing mail, closes #3880
This involved some refactoring, since we were using
ActionMailer::Base.smtp_settings[:domain] for generating "From"
addresses.

Change-Id: I6cac6d48971d396a56e07314e042b63a0081a4b6
Reviewed-on: https://gerrit.instructure.com/2398
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-02-23 08:41:50 -07:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00