From f6c6f2be207dc5a7431d79edd9426b6437bfeee1 Mon Sep 17 00:00:00 2001 From: Horia Stere Date: Fri, 28 Aug 2026 10:01:49 +0300 Subject: [PATCH 1/2] [MSDKS-2201] test CodeQL & Semgrep --- .github/workflows/codeql.yml | 52 +++++++++++++++++++++ .github/workflows/semgrep.yml | 87 +++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/semgrep.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..b664a9c --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,52 @@ +name: CodeQL SAST Scan + +on: + push: + branches: + - main + - feature/MSDKS-2201-implement-gh-codeql + pull_request: + branches: [ "main" ] + schedule: + # Run a full scan every Sunday at midnight + - cron: '0 0 * * 0' + workflow_dispatch: + +permissions: + security-events: write + packages: read + actions: read + contents: read + +jobs: + analyze: + name: CodeQL Analysis (javascript-typescript) + runs-on: ubuntu-latest + + permissions: + packages: read + actions: read + contents: read + security-events: write + + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + + - name: Initialize CodeQL + uses: github/codeql-action/init@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4 + with: + languages: javascript-typescript + build-mode: none + queries: security-extended + config: | + paths: + - BlinkCard/src + - sample_files + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4 + with: + category: /language:javascript-typescript diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml new file mode 100644 index 0000000..1f98f81 --- /dev/null +++ b/.github/workflows/semgrep.yml @@ -0,0 +1,87 @@ +name: Semgrep SAST Scan + +on: + push: + branches: + - main + - feature/MSDKS-2201-implement-gh-codeql + pull_request: + branches: [ "main" ] + schedule: + # Run a full scan every Monday at midnight + - cron: '0 0 * * 1' + workflow_dispatch: + +jobs: + semgrep-android: + name: Semgrep Scan (Android) + runs-on: ubuntu-latest + + permissions: + actions: read + contents: read + security-events: write + + container: + image: semgrep/semgrep:1.171.0@sha256:bdf7013b2c3634a487671158da77c554f531742326b543a9464d2adf6c433ac8 + + steps: + - name: Checkout Code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + + - name: Run Semgrep Scan + run: >- + semgrep scan + --config p/security-audit + --config p/secrets + --config p/owasp-top-ten + --config p/kotlin + BlinkCard/android + --sarif + --output=semgrep.sarif + + - name: Upload SARIF Results to GitHub Security Tab + uses: github/codeql-action/upload-sarif@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4 + if: always() + with: + sarif_file: semgrep.sarif + category: semgrep-android + + semgrep-ios: + name: Semgrep Scan (iOS) + runs-on: ubuntu-latest + + permissions: + actions: read + contents: read + security-events: write + + container: + image: semgrep/semgrep:1.171.0@sha256:bdf7013b2c3634a487671158da77c554f531742326b543a9464d2adf6c433ac8 + + steps: + - name: Checkout Code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + + - name: Run Semgrep Scan + run: >- + semgrep scan + --config p/security-audit + --config p/secrets + --config p/owasp-top-ten + --config p/swift + BlinkCard/ios + --exclude BlinkCard/ios/Frameworks + --sarif + --output=semgrep.sarif + + - name: Upload SARIF Results to GitHub Security Tab + uses: github/codeql-action/upload-sarif@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4 + if: always() + with: + sarif_file: semgrep.sarif + category: semgrep-ios From 81e90d5babc7c2f37dcd7e746811babb2ce33199 Mon Sep 17 00:00:00 2001 From: Horia Stere Date: Fri, 28 Aug 2026 10:11:37 +0300 Subject: [PATCH 2/2] [MSDKS-2201] add CodeQL & Semgrep --- .github/workflows/codeql.yml | 1 - .github/workflows/semgrep.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b664a9c..f9b5891 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - feature/MSDKS-2201-implement-gh-codeql pull_request: branches: [ "main" ] schedule: diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 1f98f81..ada883d 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - feature/MSDKS-2201-implement-gh-codeql pull_request: branches: [ "main" ] schedule: