Commit Graph

15 Commits

Author SHA1 Message Date
Cody Cutrer 22b7677b3b switch from byebug to debug
It's the new default debugger in ruby 3.1. Rails switched to it in 7.0,
avoids issues with Zeitwerk, has a more modern interface based on
current IRB, supports Unix Domain Sockets for remote debugging,
promises even better future maintenance due to being part of Ruby,
etc.

Change-Id: Ieaa7872f1c0308b16ae180fdb16df5dd6caa87a8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/328241
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
Build-Review: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-09-20 23:48:39 +00:00
Isaac Moore a29ad0f7e0 Read JWT secrets from Vault instead of dynamic_settings
refs AE-45
flag=none

test plan:
- specify `canvas_security` values in `vault_contents.yml`
- confirm they're loaded correctly when calling `CanvasSecurity` methods,
  like `services_encryption_secret`, `services_signing_secret`, and
  `services_previous_signing_secret`

Change-Id: Ib088eb2c123bcc32cfd6d67729916a6d7c5c2529
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/314607
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Build-Review: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
2023-05-15 18:59:18 +00:00
Isaac Moore c3f03e6186 Add Sentry trace ID to X-Canvas-Meta response header
This change adds Sentry's distributed trace ID to the `X-Canvas-Meta`
response header, so that it may be ingested by the logging pipeline and
accessed downstream.

flag=none
refs DE-1032

test plan:
- with Sentry initialized with a valid DSN, verify that the
  `X-Canvas-Meta` header contains a `st` value containing the Sentry
  trace ID
- verify that the trace ID present in the response header matches the one
  in the `meta` tag inside the body's `<head>`
- verify that when Sentry is not initialized with a valid DSN, the value
  is omitted from the response header, and the app still renders
  responses correctly

Change-Id: I63580b4d5057cebf55e6a4fdbc628d58ed7973f7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284991
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2022-02-15 23:48:15 +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 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 9b71ed2054 RuboCop: Style/BlockDelimiters, Style/Lambda
[skip-stages=Flakey]

auto-corrected

Change-Id: I642f868d75c079e698f1fe4161bbbe419dbe1827
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279374
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-23 21:30:47 +00:00
Cody Cutrer 687a81dc8e RuboCop: Style/GlobalStdStream
auto-corrected

Change-Id: Ia61715c7b8f51f1688880525f4a7d68ee91a1726
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279092
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-21 00:50:35 +00:00
Kwok Chau Lam 0a72f0b398 add operation name in response header
closes OREO-1234
flag = none

here is the problem:
- now some features use graphql endpoint to create canvas elements
- for example, recent discussion redesign use graphql queries
- but graphql requests dont have url path and query params for
app "pageview etl" when deciding page view and participation

here is the solution:
- discussed in OREO standup and detail can be found at OREO-1197
- to cover student activities, we added "operationName" in http
response "X-Canvas-meta"
- later, turbo log parser will pick up the operation name and
pass it to downstream app "pageview etl"
- later, pageview etl will use it to classify student activities
via graphql endpoint

here is the change:
- called "add-meta-header" function when the request parameters
have operation name field in it
- update unit tests accordingly

test plan:
- downloaded the change locally
- bundle update
- bundle exec rails server
- launch http://localhost:3000
- under your local organization, in account settings, enable feature
"discussion redesign"
- select a course
- if you don't have any discussion, act as a teacher and then create
a discussion
- command option i and open browser debugger
- under network tab, type "graphql"
- back to the ui, act as a student and use the student to open the
discussion created by the teacher
- in debugger, click the graphql endpoint entry, verify response header
"X-Canvas-Meta" has on=GetDiscussionQuery in it
- back to the ui, use the same student to reply the discussion
- in debugger, verify "X-Canvas-meta" has on=CreateDiscussionEntry in it

Change-Id: Ia7a208fb30dde18ac4b8413578ee6d1144283a22
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277799
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Kwok Lam <klam@instructure.com>
Product-Review: Kwok Lam <klam@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-11-10 22:37:19 +00:00
Cody Cutrer eefb34d6c2 RuboCop: RSpec/HookArgument
[skip-stages=Flakey]

auto-corrected

Change-Id: Ifb3f097064db0e00313a079a45da7e651b58d30b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277798
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-10 16:40:43 +00:00
Cody Cutrer a0a399136a RuboCop: Lint/UnusedBlockArgument config,doc,gems,lib
all manual

Change-Id: I8bb9c11634b0e2b2c8a79dd6f8f2cb71eaa90450
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276628
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-10-27 22:30:15 +00:00
Cody Cutrer 44614b47d7 RuboCop: Lint/UselessAssignment app, config, doc, gems, lib
(everything except spec)

all manual

Change-Id: I6c49a3139efb0f0802ba63a15cab4d4d2cd0b8dd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276310
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:36:29 +00:00
Cody Cutrer 475cec61e5 RuboCop: RSpec/ExampleWording gems
[skip-stages=Flakey]

Change-Id: I7bd5d93d0ec4a95971f7ce8fbff8e76b5bfea5a2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274249
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-24 02:14:45 +00:00
Cody Cutrer dd8fc67c41 RuboCop: Layout gems
Change-Id: Ie49d89234f4ffed27236a1713d072a00f637a253
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274064
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 15:35:24 +00:00
Michael Ziwisky cedfa3489f allow request context id to be set w/o signature on some paths
namely, the graphql subgraph path

refs INTEROP-6704
flag = none

test plan:
 - post to the subgraph endpoint with a base64-encoded request id
   $ curl 'http://<canvas>/api/graphql/subgraph' \
     -X POST \
     -H "X-Request-Context-Id: $(echo sweet-request-id | base64)" \
     -v

 - the response should include this header
   < X-Request-Context-Id: sweet-request-id

Change-Id: I46a905b893fd21643d5bf857fce8f54c9ab579e1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/272478
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-08-31 18:27:00 +00:00
Ethan Vizitei dd58f89f2c request_context as a gem
refs FOO-1649

Pull out middleware for request
context to a gem so that other
engines in canvas can use the
generator to look at the current
request for standard attributes
in the same way.

TEST PLAN:
  1) requests should keep on getting context ids
  2) sessions should keep getting added to the cookie jar

Change-Id: I9245491f722ac29c9544623ee14e0771ae248cd4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259609
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-02 23:02:40 +00:00