The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Move Snyk scans into the Lint Security workflow (#82197)
Chris Vandoodewaard433561ad5be6
diff --git a/.github/workflows/lint.security.yml b/.github/workflows/lint.security.ymlindex 59a61a5ddaa..83ee6759f91 100644--- a/.github/workflows/lint.security.yml+++ b/.github/workflows/lint.security.yml@@ -36,6 +36,7 @@ jobs:uses: github/codeql-action/analyze@v4trivy:+ timeout-minutes: 15strategy:fail-fast: falsematrix:@@ -68,8 +69,157 @@ jobs:sarif_file: trivy-results-${{ matrix.edition }}.sarifcategory: trivy-${{ matrix.edition }}+ # Generate pom.xml files for all Maven projects+ snyk-generate-poms:+ name: Generate pom.xml files+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}+ timeout-minutes: 20+ steps:+ - uses: actions/checkout@v6+ - name: Prepare back-end environment+ uses: ./.github/actions/prepare-backend+ - name: Generate all pom.xml+ run: .github/scripts/write-poms.sh+ - name: Upload pom files+ uses: actions/upload-artifact@v7+ with:+ name: pom-files+ path: |+ pom.xml+ modules/drivers/*/pom.xml++ # Yarn/NPM projects that don't need pom files+ snyk-frontend-projects:+ name: ${{ matrix.project.name }}+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}+ timeout-minutes: 20+ strategy:+ matrix:+ project:+ - name: Main Frontend (bun w/ yarn.lock)+ file: yarn.lock+ package-manager: yarn+ category: main-frontend-bun+ - name: Release Helper+ file: release/yarn.lock+ package-manager: yarn+ category: release-helper+ steps:+ - uses: actions/checkout@v6+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0+ with:+ bun-version-file: 'package.json'+ token: ${{ secrets.GITHUB_TOKEN }}+ # Snyk doesn't support bun.lock yet, so we generate yarn.lock and scan that.+ # Bun has a bug where it normalizes "< 3.0.0" to "< 3" in alias entries+ # but not in dependency specs, causing Snyk to fail matching dependencies.+ # The sed commands fix this inconsistency. Bun also names aliased entries+ # after the aliased package instead of the alias, which the script fixes.+ # Both continue on error to let Snyk report parsing issues directly rather+ # than failing on the workaround.+ - name: Generate yarn.lock+ if: matrix.project.file == 'yarn.lock'+ run: |+ bun install --yarn+ sed -i -E 's/< ([0-9]+)\.0\.0"/< \1"/g; s/< ([0-9]+)\.0"/< \1"/g' yarn.lock || true+ bun ${{ github.workspace }}/.github/scripts/fix-yarn-lock-aliases.ts || true+ - name: Generate release/yarn.lock+ if: matrix.project.file == 'release/yarn.lock'+ run: |+ bun install --yarn+ sed -i -E 's/< ([0-9]+)\.0\.0"/< \1"/g; s/< ([0-9]+)\.0"/< \1"/g' yarn.lock || true+ bun ${{ github.workspace }}/.github/scripts/fix-yarn-lock-aliases.ts || true+ working-directory: release+ - uses: snyk/actions/setup@9adf32b1121593767fc3c057af55b55db032dc04 # v1.0.0+ - name: Run snyk test+ env:+ SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}+ continue-on-error: true+ run: snyk test --org="metabase-AnD9iS4Wfu4eBYMsG2DZ5N" --remote-repo-url="https://github.com/metabase/metabase" --file=${{ matrix.project.file }} --package-manager=${{ matrix.project.package-manager }} --sarif-file-output=snyk-${{ matrix.project.category }}.sarif+ - name: Upload results+ uses: github/codeql-action/upload-sarif@v4+ with:+ sarif_file: snyk-${{ matrix.project.category }}.sarif+ category: ${{ matrix.project.category }}++ # Maven projects that need pom files+ snyk-maven-projects:+ needs: snyk-generate-poms+ name: ${{ matrix.project.name }}+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}+ timeout-minutes: 20+ strategy:+ matrix:+ project:+ - name: Main Backend (maven)+ file: pom.xml+ category: main-backend-maven+ - name: Driver - Athena+ file: modules/drivers/athena/pom.xml+ category: driver-athena+ - name: Driver - BigQuery Cloud SDK+ file: modules/drivers/bigquery-cloud-sdk/pom.xml+ category: driver-bigquery-cloud-sdk+ - name: Driver - ClickHouse+ file: modules/drivers/clickhouse/pom.xml+ category: driver-clickhouse+ - name: Driver - Databricks+ file: modules/drivers/databricks/pom.xml+ category: driver-databricks+ - name: Driver - Druid JDBC+ file: modules/drivers/druid-jdbc/pom.xml+ category: driver-druid-jdbc+ - name: Driver - Hive-like+ file: modules/drivers/hive-like/pom.xml+ category: driver-hive-like+ - name: Driver - MongoDB+ file: modules/drivers/mongo/pom.xml+ category: driver-mongo+ - name: Driver - Oracle+ file: modules/drivers/oracle/pom.xml+ category: driver-oracle+ - name: Driver - Presto JDBC+ file: modules/drivers/presto-jdbc/pom.xml+ category: driver-presto-jdbc+ - name: Driver - Redshift+ file: modules/drivers/redshift/pom.xml+ category: driver-redshift+ - name: Driver - Snowflake+ file: modules/drivers/snowflake/pom.xml+ category: driver-snowflake+ - name: Driver - SparkSQL+ file: modules/drivers/sparksql/pom.xml+ category: driver-sparksql+ - name: Driver - SQL Server+ file: modules/drivers/sqlserver/pom.xml+ category: driver-sqlserver+ - name: Driver - Starburst+ file: modules/drivers/starburst/pom.xml+ category: driver-starburst+ - name: Driver - Vertica+ file: modules/drivers/vertica/pom.xml+ category: driver-vertica+ steps:+ - uses: actions/checkout@v6+ - uses: snyk/actions/setup@9adf32b1121593767fc3c057af55b55db032dc04 # v1.0.0+ - name: Download pom files+ uses: actions/download-artifact@v8+ with:+ name: pom-files+ - name: Run snyk test+ env:+ SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}+ continue-on-error: true+ run: snyk test --org="metabase-AnD9iS4Wfu4eBYMsG2DZ5N" --remote-repo-url="https://github.com/metabase/metabase" --file=${{ matrix.project.file }} --package-manager=maven --sarif-file-output=snyk-${{ matrix.project.category }}.sarif++ - name: Upload results+ uses: github/codeql-action/upload-sarif@v4+ with:+ sarif_file: snyk-${{ matrix.project.category }}.sarif+ category: ${{ matrix.project.category }}+notify:- needs: [codeql, trivy]+ needs: [codeql, trivy, snyk-frontend-projects, snyk-maven-projects]if: ${{ failure() && github.repository == 'metabase/metabase' }}runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}timeout-minutes: 5@@ -94,6 +244,8 @@ jobs:const scans = [['CodeQL', '${{ needs.codeql.result }}'],['Trivy', '${{ needs.trivy.result }}'],+ ['Snyk (frontend)', '${{ needs.snyk-frontend-projects.result }}'],+ ['Snyk (maven)', '${{ needs.snyk-maven-projects.result }}'],];const failed = scans.filter(([, result]) => result === 'failure').map(([name]) => name);diff --git a/.github/workflows/snyk.yml b/.github/workflows/snyk.ymldeleted file mode 100644index d57800a06aa..00000000000--- a/.github/workflows/snyk.yml+++ /dev/null@@ -1,165 +0,0 @@-name: "Snyk"--on:- push:- branches:- - "master"- - "release-**"- paths:- - "**/deps.edn"- - "**/package.json"- - ".github/workflows/snyk.yml"- - ".github/scripts/write-poms.sh"- - ".github/scripts/fix-yarn-lock-aliases.ts"- schedule:- - cron: "0 5 * * *"--jobs:- # Generate pom.xml files for all Maven projects- generate-poms:- if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}- name: Generate pom.xml files- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- steps:- - uses: actions/checkout@v6- - name: Prepare back-end environment- uses: ./.github/actions/prepare-backend- - name: Generate all pom.xml- run: .github/scripts/write-poms.sh- - name: Upload pom files- uses: actions/upload-artifact@v7- with:- name: pom-files- path: |- pom.xml- modules/drivers/*/pom.xml-- # Yarn/NPM projects that don't need pom files- frontend-projects:- if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}- name: ${{ matrix.project.name }}- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- strategy:- matrix:- project:- - name: Main Frontend (bun w/ yarn.lock)- file: yarn.lock- package-manager: yarn- category: main-frontend-bun- - name: Release Helper- file: release/yarn.lock- package-manager: yarn- category: release-helper- steps:- - uses: actions/checkout@v6- - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0- with:- bun-version-file: 'package.json'- token: ${{ secrets.GITHUB_TOKEN }}- # Snyk doesn't support bun.lock yet, so we generate yarn.lock and scan that.- # Bun has a bug where it normalizes "< 3.0.0" to "< 3" in alias entries- # but not in dependency specs, causing Snyk to fail matching dependencies.- # The sed commands fix this inconsistency. Bun also names aliased entries- # after the aliased package instead of the alias, which the script fixes.- # Both continue on error to let Snyk report parsing issues directly rather- # than failing on the workaround.- - name: Generate yarn.lock- if: matrix.project.file == 'yarn.lock'- run: |- bun install --yarn- sed -i -E 's/< ([0-9]+)\.0\.0"/< \1"/g; s/< ([0-9]+)\.0"/< \1"/g' yarn.lock || true- bun ${{ github.workspace }}/.github/scripts/fix-yarn-lock-aliases.ts || true- - name: Generate release/yarn.lock- if: matrix.project.file == 'release/yarn.lock'- run: |- bun install --yarn- sed -i -E 's/< ([0-9]+)\.0\.0"/< \1"/g; s/< ([0-9]+)\.0"/< \1"/g' yarn.lock || true- bun ${{ github.workspace }}/.github/scripts/fix-yarn-lock-aliases.ts || true- working-directory: release- - uses: snyk/actions/setup@9adf32b1121593767fc3c057af55b55db032dc04 # v1.0.0- - name: Run snyk test- env:- SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}- continue-on-error: true- run: snyk test --org="metabase-AnD9iS4Wfu4eBYMsG2DZ5N" --remote-repo-url="https://github.com/metabase/metabase" --file=${{ matrix.project.file }} --package-manager=${{ matrix.project.package-manager }} --sarif-file-output=snyk-${{ matrix.project.category }}.sarif- - name: Upload results- uses: github/codeql-action/upload-sarif@v3- with:- sarif_file: snyk-${{ matrix.project.category }}.sarif- category: ${{ matrix.project.category }}-- # Maven projects that need pom files- maven-projects:- needs: generate-poms- if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}- name: ${{ matrix.project.name }}- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- strategy:- matrix:- project:- - name: Main Backend (maven)- file: pom.xml- category: main-backend-maven- - name: Driver - Athena- file: modules/drivers/athena/pom.xml- category: driver-athena- - name: Driver - BigQuery Cloud SDK- file: modules/drivers/bigquery-cloud-sdk/pom.xml- category: driver-bigquery-cloud-sdk- - name: Driver - ClickHouse- file: modules/drivers/clickhouse/pom.xml- category: driver-clickhouse- - name: Driver - Databricks- file: modules/drivers/databricks/pom.xml- category: driver-databricks- - name: Driver - Druid JDBC- file: modules/drivers/druid-jdbc/pom.xml- category: driver-druid-jdbc- - name: Driver - Hive-like- file: modules/drivers/hive-like/pom.xml- category: driver-hive-like- - name: Driver - MongoDB- file: modules/drivers/mongo/pom.xml- category: driver-mongo- - name: Driver - Oracle- file: modules/drivers/oracle/pom.xml- category: driver-oracle- - name: Driver - Presto JDBC- file: modules/drivers/presto-jdbc/pom.xml- category: driver-presto-jdbc- - name: Driver - Redshift- file: modules/drivers/redshift/pom.xml- category: driver-redshift- - name: Driver - Snowflake- file: modules/drivers/snowflake/pom.xml- category: driver-snowflake- - name: Driver - SparkSQL- file: modules/drivers/sparksql/pom.xml- category: driver-sparksql- - name: Driver - SQL Server- file: modules/drivers/sqlserver/pom.xml- category: driver-sqlserver- - name: Driver - Starburst- file: modules/drivers/starburst/pom.xml- category: driver-starburst- - name: Driver - Vertica- file: modules/drivers/vertica/pom.xml- category: driver-vertica- steps:- - uses: actions/checkout@v6- - uses: snyk/actions/setup@9adf32b1121593767fc3c057af55b55db032dc04 # v1.0.0- - name: Download pom files- uses: actions/download-artifact@v8- with:- name: pom-files- - name: Run snyk test- env:- SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}- continue-on-error: true- run: snyk test --org="metabase-AnD9iS4Wfu4eBYMsG2DZ5N" --remote-repo-url="https://github.com/metabase/metabase" --file=${{ matrix.project.file }} --package-manager=maven --sarif-file-output=snyk-${{ matrix.project.category }}.sarif-- - name: Upload results- uses: github/codeql-action/upload-sarif@v3- with:- sarif_file: snyk-${{ matrix.project.category }}.sarif- category: ${{ matrix.project.category }}