From f5bd71e83e79f925cdb3bde8cdd64fcfbcc1ba54 Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 13:19:17 -0400 Subject: [PATCH 01/14] feature tracking demo --- .github/workflows/item_scan.yml | 38 +++++++++++++++++++ .../src/metabase/components/UserAvatar.jsx | 2 +- src/metabase/api/session.clj | 5 +++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/item_scan.yml diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml new file mode 100644 index 000000000000..a46c9a0232e4 --- /dev/null +++ b/.github/workflows/item_scan.yml @@ -0,0 +1,38 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Scan Code + run: git grep -n HIPSPEC- > report.txt + + - name: Save Scan As Artifact + uses: actions/upload-artifact@v2 + with: + name: report + path: report.txt + # Runs a set of commands using the runners shell + # - name: Run a multi-line script + # run: | + # echo Add other actions to build, + # echo test, and deploy your project. \ No newline at end of file diff --git a/frontend/src/metabase/components/UserAvatar.jsx b/frontend/src/metabase/components/UserAvatar.jsx index f0ac0ecaa3c9..7c4d4a0f0156 100644 --- a/frontend/src/metabase/components/UserAvatar.jsx +++ b/frontend/src/metabase/components/UserAvatar.jsx @@ -1,5 +1,5 @@ /* @flow */ - +// HIPSPEC-9JF7M58 import styled from "styled-components"; import { Flex } from "grid-styled"; import { height } from "styled-system"; diff --git a/src/metabase/api/session.clj b/src/metabase/api/session.clj index 24bcbdbdf67f..590083a2b38b 100644 --- a/src/metabase/api/session.clj +++ b/src/metabase/api/session.clj @@ -67,6 +67,8 @@ (def ^:private password-fail-snippet (deferred-tru "did not match stored password")) (s/defn ^:private ldap-login :- (s/maybe UUID) + ;; HIPSPEC-0ZXOVYQ + ;; HIPSPEC-8I2UMLY "If LDAP is enabled and a matching user exists return a new Session for them, or `nil` if they couldn't be authenticated." [username password] @@ -171,6 +173,7 @@ :ip-address (throttle/make-throttler :email, :attempts-threshold 50)}) (api/defendpoint POST "/forgot_password" + ;; HIPSPEC-ZGHOEQW "Send a reset email when user has forgotten their password." [:as {:keys [server-name] {:keys [email]} :body, :as request}] {email su/Email} @@ -260,6 +263,7 @@ (def ^:private google-auth-token-info-url "https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=%s") (defn- google-auth-token-info + ;; HIPSPEC-FSCXB53 ([token-info-response] (google-auth-token-info token-info-response (google-auth-client-id))) ([token-info-response client-id] @@ -323,6 +327,7 @@ (mw.session/set-session-cookie request response session-id)))) (api/defendpoint POST "/google_auth" + ;; HIPSPEC-FSCXB53 "Login with Google Auth." [:as {{:keys [token]} :body, :as request}] {token su/NonBlankString} From fd4568ef457b024b9c774337a4ec1e6459866cdf Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 14:32:38 -0400 Subject: [PATCH 02/14] docker demo --- .github/workflows/item_scan.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index a46c9a0232e4..3b35e96fbdde 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -21,6 +21,16 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 + + - name: Demo Docker + uses: docker://ruby:2.7 + with: + first_name: Mona + middle_name: The + last_name: Octocat + run: | + echo $MY_VAR $FIRST_NAME $MIDDLE_NAME $LAST_NAME + ruby -v > ruby-demo.txt # Runs a single command using the runners shell - name: Scan Code @@ -31,6 +41,12 @@ jobs: with: name: report path: report.txt + + - name: Save Ruby As Artifact + uses: actions/upload-artifact@v2 + with: + name: ruby-demo + path: ruby-demo.txt # Runs a set of commands using the runners shell # - name: Run a multi-line script # run: | From 28874eb6e1d9bbf782ae2b49c600a44b5236bee3 Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 15:22:53 -0400 Subject: [PATCH 03/14] testing external custom action --- .github/workflows/item_scan.yml | 47 ++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index 3b35e96fbdde..53b34eba1dde 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -21,16 +21,19 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - - - name: Demo Docker - uses: docker://ruby:2.7 + - uses: actions/setup-ruby@v1 with: - first_name: Mona - middle_name: The - last_name: Octocat - run: | - echo $MY_VAR $FIRST_NAME $MIDDLE_NAME $LAST_NAME - ruby -v > ruby-demo.txt + ruby-version: '2.7' # Version range or exact version of a Ruby version to use, using semvers version range syntax. + - run: ruby -v + # - name: Demo Docker + # uses: docker://ruby:2.7 + # with: + # first_name: Mona + # middle_name: The + # last_name: Octocat + # run: | + # echo $MY_VAR $FIRST_NAME $MIDDLE_NAME $LAST_NAME + # ruby -v > ruby-demo.txt # Runs a single command using the runners shell - name: Scan Code @@ -42,13 +45,27 @@ jobs: name: report path: report.txt - - name: Save Ruby As Artifact - uses: actions/upload-artifact@v2 - with: - name: ruby-demo - path: ruby-demo.txt + # - name: Save Ruby As Artifact + # uses: actions/upload-artifact@v2 + # with: + # name: ruby-demo + # path: ruby-demo.txt # Runs a set of commands using the runners shell # - name: Run a multi-line script # run: | # echo Add other actions to build, - # echo test, and deploy your project. \ No newline at end of file + # echo test, and deploy your project. + hello_world_job: + runs-on: ubuntu-latest + name: A job to say hello + steps: + - name: HipSpec Hello world action step + id: hello + uses: HipSpec/hipspec-scan@v1 + with: + who-to-greet: 'Gus the Octocat' + # Use the output from the `hello` step + - name: Get the output time + run: echo "The time was ${{ steps.hello.outputs.time }}" + + \ No newline at end of file From d06d202e7f39dbf28ddbcbbe84dad4001384c16d Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 15:29:09 -0400 Subject: [PATCH 04/14] testing external custom action 2 --- .github/workflows/item_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index 53b34eba1dde..03c95b9cab56 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -59,7 +59,7 @@ jobs: runs-on: ubuntu-latest name: A job to say hello steps: - - name: HipSpec Hello world action step + - name: HipSpec Hello world action step 2 id: hello uses: HipSpec/hipspec-scan@v1 with: From 193b48e514441b3b5093bc18fc4c9e987551df2a Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 15:33:13 -0400 Subject: [PATCH 05/14] testing external custom action 3 --- .github/workflows/item_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index 03c95b9cab56..e4a4ff1b6981 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -59,7 +59,7 @@ jobs: runs-on: ubuntu-latest name: A job to say hello steps: - - name: HipSpec Hello world action step 2 + - name: HipSpec Hello world action step 3 id: hello uses: HipSpec/hipspec-scan@v1 with: From 096476110c24b702975a6a4edb8616b0fa258a37 Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 15:37:36 -0400 Subject: [PATCH 06/14] testing external custom action 4 --- .github/workflows/item_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index e4a4ff1b6981..fcf22293a9fc 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -59,7 +59,7 @@ jobs: runs-on: ubuntu-latest name: A job to say hello steps: - - name: HipSpec Hello world action step 3 + - name: HipSpec Hello world action step 4 id: hello uses: HipSpec/hipspec-scan@v1 with: From e9579adf33ff3f7ab74cef296ce236938efc369b Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 15:54:27 -0400 Subject: [PATCH 07/14] testing external action - v2 --- .github/workflows/item_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index fcf22293a9fc..57d1e1d92dbf 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -61,7 +61,7 @@ jobs: steps: - name: HipSpec Hello world action step 4 id: hello - uses: HipSpec/hipspec-scan@v1 + uses: HipSpec/hipspec-scan@v2 with: who-to-greet: 'Gus the Octocat' # Use the output from the `hello` step From a9a3decc22387884c2a2c79160e318a3252a7655 Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 15:57:30 -0400 Subject: [PATCH 08/14] testing external action - v1 revert --- .github/workflows/item_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index 57d1e1d92dbf..fcf22293a9fc 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -61,7 +61,7 @@ jobs: steps: - name: HipSpec Hello world action step 4 id: hello - uses: HipSpec/hipspec-scan@v2 + uses: HipSpec/hipspec-scan@v1 with: who-to-greet: 'Gus the Octocat' # Use the output from the `hello` step From bb61ca02b367e32b7de99ac8a8029beadfe3a99b Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 16:07:33 -0400 Subject: [PATCH 09/14] checkout step --- .github/workflows/item_scan.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index fcf22293a9fc..e0c32a859494 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -59,6 +59,8 @@ jobs: runs-on: ubuntu-latest name: A job to say hello steps: + - name: Checkout + uses: actions/checkout@v2 - name: HipSpec Hello world action step 4 id: hello uses: HipSpec/hipspec-scan@v1 From 1ea2a4a62f0475e5fb194f5f6cfac1b9c869f435 Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Wed, 29 Jul 2020 16:33:55 -0400 Subject: [PATCH 10/14] adding webhook env --- .github/workflows/item_scan.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index e0c32a859494..52a6b065adbd 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -64,6 +64,8 @@ jobs: - name: HipSpec Hello world action step 4 id: hello uses: HipSpec/hipspec-scan@v1 + env: + HIPSPEC_WEBHOOK: ${{ secrets.HIPSPEC_WEBHOOK }} with: who-to-greet: 'Gus the Octocat' # Use the output from the `hello` step From 8b313cd7e7b323db40c301895f930fe74d2b7d11 Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Thu, 30 Jul 2020 14:52:41 -0400 Subject: [PATCH 11/14] webhook testing push --- .github/workflows/item_scan.yml | 4 ++-- frontend/src/metabase/alert/alert.js | 2 ++ src/metabase/api/alert.clj | 1 + test/metabase/api/alert_test.clj | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index 52a6b065adbd..825148536c9b 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -57,11 +57,11 @@ jobs: # echo test, and deploy your project. hello_world_job: runs-on: ubuntu-latest - name: A job to say hello + name: A job to Scan Product Features From Repos steps: - name: Checkout uses: actions/checkout@v2 - - name: HipSpec Hello world action step 4 + - name: HipSpec Scan id: hello uses: HipSpec/hipspec-scan@v1 env: diff --git a/frontend/src/metabase/alert/alert.js b/frontend/src/metabase/alert/alert.js index 2fc3b7f2ca22..bf8893d7a46e 100644 --- a/frontend/src/metabase/alert/alert.js +++ b/frontend/src/metabase/alert/alert.js @@ -111,6 +111,8 @@ export const updateAlert = alert => { export const UNSUBSCRIBE_FROM_ALERT = "metabase/alerts/UNSUBSCRIBE_FROM_ALERT"; export const UNSUBSCRIBE_FROM_ALERT_CLEANUP = "metabase/alerts/UNSUBSCRIBE_FROM_ALERT_CLEANUP"; + +// HIPSPEC-GZHQERJ const unsubscribeFromAlertRequest = new RestfulRequest({ endpoint: AlertApi.unsubscribe, actionPrefix: UNSUBSCRIBE_FROM_ALERT, diff --git a/src/metabase/api/alert.clj b/src/metabase/api/alert.clj index c0075d653902..41faac68ced8 100644 --- a/src/metabase/api/alert.clj +++ b/src/metabase/api/alert.clj @@ -192,6 +192,7 @@ ;; No need to unsubscribe if we're just going to delete the Pulse (db/delete! Pulse :id id) ;; There are other receipieints, remove current user only + ;; HIPSPEC-GZHQERJ (pulse/unsubscribe-from-alert! id api/*current-user-id*)) ;; Send emails letting people know they have been unsubscribe (when (email/email-configured?) diff --git a/test/metabase/api/alert_test.clj b/test/metabase/api/alert_test.clj index e688ee68167a..2998a24dc4c8 100644 --- a/test/metabase/api/alert_test.clj +++ b/test/metabase/api/alert_test.clj @@ -632,9 +632,10 @@ ;;; +----------------------------------------------------------------------------------------------------------------+ -;;; | PUT /api/alert/:id/unsubscribe | +;;; | PUT /api/alert/:id/unsubscribe ;;; HIPSPEC-GZHQERJ | ;;; +----------------------------------------------------------------------------------------------------------------+ + (defn- alert-unsubscribe-url [alert-or-id] (format "alert/%d/unsubscribe" (u/get-id alert-or-id))) From 527d76ab6acf908bd3feffded91bb3e4d1f9e251 Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Thu, 30 Jul 2020 15:28:26 -0400 Subject: [PATCH 12/14] updating scan action invocation --- .github/workflows/item_scan.yml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/item_scan.yml b/.github/workflows/item_scan.yml index 825148536c9b..cc4abf951e85 100644 --- a/.github/workflows/item_scan.yml +++ b/.github/workflows/item_scan.yml @@ -45,31 +45,21 @@ jobs: name: report path: report.txt - # - name: Save Ruby As Artifact - # uses: actions/upload-artifact@v2 - # with: - # name: ruby-demo - # path: ruby-demo.txt - # Runs a set of commands using the runners shell - # - name: Run a multi-line script - # run: | - # echo Add other actions to build, - # echo test, and deploy your project. - hello_world_job: + hipspec_scan_job: runs-on: ubuntu-latest name: A job to Scan Product Features From Repos steps: - name: Checkout uses: actions/checkout@v2 - name: HipSpec Scan - id: hello - uses: HipSpec/hipspec-scan@v1 + id: hipspec-scan + uses: HipSpec/hipspec-scan@develop env: HIPSPEC_WEBHOOK: ${{ secrets.HIPSPEC_WEBHOOK }} - with: - who-to-greet: 'Gus the Octocat' + # with: + # who-to-greet: 'Gus the Octocat' # Use the output from the `hello` step - - name: Get the output time - run: echo "The time was ${{ steps.hello.outputs.time }}" + # - name: Get the output time + # run: echo "The time was ${{ steps.hello.outputs.time }}" \ No newline at end of file From 97cab60b0647a6860ad1bb6ff56b17d03389d00b Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Thu, 30 Jul 2020 21:10:16 -0400 Subject: [PATCH 13/14] adding gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 449fd2a33324..d77855a3afa3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.rb *.class *.iml *.jar From c502addf474497c38aa82978c17a14543401e414 Mon Sep 17 00:00:00 2001 From: Mason Hensley Date: Tue, 4 Aug 2020 14:14:25 -0400 Subject: [PATCH 14/14] cataloging more functionality --- README.md | 3 +++ frontend/src/metabase/entities/containers/EntityListLoader.jsx | 2 ++ frontend/src/metabase/entities/users/forms.js | 2 ++ frontend/src/metabase/lib/settings.js | 2 +- frontend/src/metabase/plugins/builtin/auth/ldap.js | 1 + frontend/src/metabase/services.js | 1 + src/metabase/api/ldap.clj | 1 + src/metabase/public_settings.clj | 1 + 8 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 810203818495..b797f05bf330 100644 --- a/README.md +++ b/README.md @@ -125,3 +125,6 @@ Unless otherwise noted, all Metabase source files are made available under the t See [LICENSE.txt](https://github.com/metabase/metabase/blob/master/LICENSE.txt) for details and exceptions. Unless otherwise noted, all files © 2019 Metabase, Inc. + +# Sample +Touching project. \ No newline at end of file diff --git a/frontend/src/metabase/entities/containers/EntityListLoader.jsx b/frontend/src/metabase/entities/containers/EntityListLoader.jsx index 6c4eaf74758f..eb626865d1d9 100644 --- a/frontend/src/metabase/entities/containers/EntityListLoader.jsx +++ b/frontend/src/metabase/entities/containers/EntityListLoader.jsx @@ -47,6 +47,8 @@ const getEntityQuery = (state, props) => // object is created. This works because entityQuery must be JSON serializable // NOTE: Technically leaks a small amount of memory because it uses an unbounded // memoization cache, but that's probably ok. +// HIPSPEC-6KR3TZB + const getMemoizedEntityQuery = createMemoizedSelector( [getEntityQuery], entityQuery => entityQuery, diff --git a/frontend/src/metabase/entities/users/forms.js b/frontend/src/metabase/entities/users/forms.js index c950cc47e149..9f6f81558c97 100644 --- a/frontend/src/metabase/entities/users/forms.js +++ b/frontend/src/metabase/entities/users/forms.js @@ -29,6 +29,7 @@ const DETAILS_FORM_FIELDS: () => FormFieldDefinition[] = () => [ }, ]; +// HIPSPEC-KDECLSP const LOCALE_FIELD: FormFieldDefinition = { name: "locale", title: t`Language`, @@ -42,6 +43,7 @@ const LOCALE_FIELD: FormFieldDefinition = { ].map(([code, name]) => ({ name, value: code })), }; +// HIPSPEC-VB4X2RW const PASSWORD_FORM_FIELDS: () => FormFieldDefinition[] = () => [ { name: "password", diff --git a/frontend/src/metabase/lib/settings.js b/frontend/src/metabase/lib/settings.js index 8f0165feb5d6..03baee22b6ac 100644 --- a/frontend/src/metabase/lib/settings.js +++ b/frontend/src/metabase/lib/settings.js @@ -95,7 +95,7 @@ class Settings { ssoEnabled() { return this.get("google-auth-client-id") != null; } - + // HIPSPEC-8I2UMLY ldapEnabled() { return this.get("ldap-configured?"); } diff --git a/frontend/src/metabase/plugins/builtin/auth/ldap.js b/frontend/src/metabase/plugins/builtin/auth/ldap.js index 5ff2f8e7fd51..9a24bbc27cfa 100644 --- a/frontend/src/metabase/plugins/builtin/auth/ldap.js +++ b/frontend/src/metabase/plugins/builtin/auth/ldap.js @@ -7,6 +7,7 @@ import SettingsLdapForm from "metabase/admin/settings/components/SettingsLdapFor import AuthenticationOption from "metabase/admin/settings/components/widgets/AuthenticationOption"; import GroupMappingsWidget from "metabase/admin/settings/components/widgets/GroupMappingsWidget"; +// HIPSPEC-8I2UMLY PLUGIN_ADMIN_SETTINGS_UPDATES.push( sections => updateIn(sections, ["authentication", "settings"], settings => [ diff --git a/frontend/src/metabase/services.js b/frontend/src/metabase/services.js index 40a5e8176d48..7fec149b6432 100644 --- a/frontend/src/metabase/services.js +++ b/frontend/src/metabase/services.js @@ -117,6 +117,7 @@ export const SlackApi = { updateSettings: PUT("/api/slack/settings"), }; +// HIPSPEC-8I2UMLY export const LdapApi = { updateSettings: PUT("/api/ldap/settings"), }; diff --git a/src/metabase/api/ldap.clj b/src/metabase/api/ldap.clj index ae45645b8572..7b4ab8a1de92 100644 --- a/src/metabase/api/ldap.clj +++ b/src/metabase/api/ldap.clj @@ -1,3 +1,4 @@ +;; HIPSPEC-8I2UMLY (ns metabase.api.ldap "/api/ldap endpoints" (:require [clojure.set :as set] diff --git a/src/metabase/public_settings.clj b/src/metabase/public_settings.clj index 9b99ec1a6f38..6080edf8b081 100644 --- a/src/metabase/public_settings.clj +++ b/src/metabase/public_settings.clj @@ -270,6 +270,7 @@ :setter :none :getter (fn [] (db/exists? 'Database, :is_sample true))) +; HIPSPEC-O0EFWR5 (defsetting password-complexity "Current password complexity requirements" :visibility :public