From eebe9f0e2cc13b66e76869080157d933ad312335 Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 16:03:18 -0500 Subject: [PATCH 01/11] Add CodeQL analysis workflow configuration --- .github/workflows/codeql.yml | 100 +++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..64d7024 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,100 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '27 4 * * 4' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: javascript-typescript + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 5793e35bc7a5309ae62c9908815816390d90ea00 Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 16:18:15 -0500 Subject: [PATCH 02/11] feat: TBD sonar cube, codeql as workflow file --- .github/workflows/code_evaulation.yml | 7 ++++++- .github/workflows/codeql.yml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code_evaulation.yml b/.github/workflows/code_evaulation.yml index a75a5a8..18a5854 100644 --- a/.github/workflows/code_evaulation.yml +++ b/.github/workflows/code_evaulation.yml @@ -38,4 +38,9 @@ jobs: uses: actions/dependency-review-action@v4 continue-on-error: true with: - comment-summary-in-pr: always \ No newline at end of file + comment-summary-in-pr: always + Code-Scanning: + name: Other Code Scanning + runs-on: ubuntu-latest + steps: + - run: echo "Future Location of Sonar Cube Scanner" \ No newline at end of file diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 64d7024..abc4bc8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -57,7 +57,7 @@ jobs: # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 # Add any setup steps before running the `github/codeql-action/init` action. # This includes steps like installing compilers or runtimes (`actions/setup-node` From 0e2d751ed8a8145cb9fc4c7affbd721950677343 Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 16:20:40 -0500 Subject: [PATCH 03/11] fix: branch name --- .github/workflows/code_evaulation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_evaulation.yml b/.github/workflows/code_evaulation.yml index 18a5854..6605226 100644 --- a/.github/workflows/code_evaulation.yml +++ b/.github/workflows/code_evaulation.yml @@ -1,7 +1,7 @@ name: Code Evaluation on: pull_request: - branches: Main + branches: [ "main" ] workflow_dispatch: jobs: Code-Security: From a771642bba685766683bb037703f9c6d579a2eb1 Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 17:07:47 -0500 Subject: [PATCH 04/11] feat: move scans to parallel jobs --- .github/workflows/code_evaulation.yml | 74 +++++++++++++++++---------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/.github/workflows/code_evaulation.yml b/.github/workflows/code_evaulation.yml index 6605226..086e171 100644 --- a/.github/workflows/code_evaulation.yml +++ b/.github/workflows/code_evaulation.yml @@ -1,46 +1,66 @@ -name: Code Evaluation +name: Code Security on: pull_request: branches: [ "main" ] workflow_dispatch: jobs: - Code-Security: - name: Code Security + App: + name: Getting App... runs-on: ubuntu-latest + permissions: {} + outputs: + app_token: ${{ steps.app-token.outputs.token }} + steps: + - uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ secrets.UWH_SECURITY_BOT_ID }} + private-key: ${{ secrets.UWH_SECURITY_BOT_KEY }} + KEV: + name: 'KEV Policy' + runs-on: ubuntu-latest + needs: App permissions: security-events: read contents: read - + pull-requests: write steps: - - name: 'Checkout Repository' - uses: actions/checkout@v5 - - - uses: actions/create-github-app-token@v2 - id: app-token - with: - app-id: ${{ secrets.UWH_SECURITY_BOT_ID }} - private-key: ${{ secrets.UWH_SECURITY_BOT_KEY }} - - - name: 'KEV Policy' - uses: advanced-security/dependabot-kev-action@v0 - continue-on-error: true + - uses: advanced-security/dependabot-kev-action@v0 env: - GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} - - - name: 'EPSS Policy' - uses: advanced-security/dependabot-epss-action@v0 - continue-on-error: true - with: - token: ${{ steps.app-token.outputs.token }} - epss-threshold: "0.2" + GITHUB_TOKEN: ${{ needs.App.outputs.app_token }} + EPSS: + name: 'EPSS Policy' + runs-on: ubuntu-latest + needs: App + permissions: + security-events: read + contents: read + pull-requests: write + steps: + - uses: advanced-security/dependabot-epss-action@v0 + with: + token: ${{ needs.App.outputs.app_token }} + epss-threshold: "0.2" + Dep-Review: + name: 'Dependency Review' + runs-on: ubuntu-latest + permissions: + security-events: read + contents: read + pull-requests: write + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v5 + - name: 'Dependency Review' uses: actions/dependency-review-action@v4 continue-on-error: true with: - comment-summary-in-pr: always - Code-Scanning: - name: Other Code Scanning + comment-summary-in-pr: always + + Sonar-Scanning: + name: Sonar Code Scanning runs-on: ubuntu-latest steps: - run: echo "Future Location of Sonar Cube Scanner" \ No newline at end of file From beae8760dbffc87ea753ee43f2c7ae6dc28762cc Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 17:17:38 -0500 Subject: [PATCH 05/11] fix: app token for each job --- .github/workflows/code_evaulation.yml | 34 ++++++++++++--------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/code_evaulation.yml b/.github/workflows/code_evaulation.yml index 086e171..cc5e018 100644 --- a/.github/workflows/code_evaulation.yml +++ b/.github/workflows/code_evaulation.yml @@ -4,42 +4,38 @@ on: branches: [ "main" ] workflow_dispatch: jobs: - App: - name: Getting App... - runs-on: ubuntu-latest - permissions: {} - outputs: - app_token: ${{ steps.app-token.outputs.token }} - steps: - - uses: actions/create-github-app-token@v2 - id: app-token - with: - app-id: ${{ secrets.UWH_SECURITY_BOT_ID }} - private-key: ${{ secrets.UWH_SECURITY_BOT_KEY }} KEV: name: 'KEV Policy' runs-on: ubuntu-latest - needs: App permissions: security-events: read contents: read pull-requests: write steps: - - uses: advanced-security/dependabot-kev-action@v0 - env: - GITHUB_TOKEN: ${{ needs.App.outputs.app_token }} + - uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ secrets.UWH_SECURITY_BOT_ID }} + private-key: ${{ secrets.UWH_SECURITY_BOT_KEY }} + - uses: advanced-security/dependabot-kev-action@v0 + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} EPSS: name: 'EPSS Policy' - runs-on: ubuntu-latest - needs: App + runs-on: ubuntu-latest permissions: security-events: read contents: read pull-requests: write steps: + - uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ secrets.UWH_SECURITY_BOT_ID }} + private-key: ${{ secrets.UWH_SECURITY_BOT_KEY }} - uses: advanced-security/dependabot-epss-action@v0 with: - token: ${{ needs.App.outputs.app_token }} + token: ${{ steps.app-token.outputs.token }} epss-threshold: "0.2" Dep-Review: From d30e9e3845e3e062fc2b47eeb51a16509e284051 Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 17:26:57 -0500 Subject: [PATCH 06/11] fix: naming --- .github/workflows/{code_evaulation.yml => code_security.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{code_evaulation.yml => code_security.yml} (100%) diff --git a/.github/workflows/code_evaulation.yml b/.github/workflows/code_security.yml similarity index 100% rename from .github/workflows/code_evaulation.yml rename to .github/workflows/code_security.yml From a608a3b570bb51c434373b6098e8d7c64e305bcf Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 17:30:52 -0500 Subject: [PATCH 07/11] Update .github/workflows/code_security.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/code_security.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_security.yml b/.github/workflows/code_security.yml index cc5e018..4192831 100644 --- a/.github/workflows/code_security.yml +++ b/.github/workflows/code_security.yml @@ -1,7 +1,7 @@ name: Code Security on: pull_request: - branches: [ "main" ] + branches: [ "main" ] workflow_dispatch: jobs: KEV: From f7001711b19e27c24aef2c86d1d31c3ab1fb9c61 Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 17:32:08 -0500 Subject: [PATCH 08/11] Update .github/workflows/code_security.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/code_security.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code_security.yml b/.github/workflows/code_security.yml index 4192831..97dff93 100644 --- a/.github/workflows/code_security.yml +++ b/.github/workflows/code_security.yml @@ -1,8 +1,8 @@ name: Code Security on: - pull_request: - branches: [ "main" ] - workflow_dispatch: + pull_request: + branches: [ "main" ] + workflow_dispatch: jobs: KEV: name: 'KEV Policy' From 711d47569a4524f61245833aac3677918bba1461 Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 17:59:47 -0500 Subject: [PATCH 09/11] feat: sonarqube scan --- .github/workflows/code_security.yml | 17 ++++++++++++----- sonar-project.properties | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/code_security.yml b/.github/workflows/code_security.yml index 97dff93..ddef0da 100644 --- a/.github/workflows/code_security.yml +++ b/.github/workflows/code_security.yml @@ -1,8 +1,9 @@ name: Code Security on: - pull_request: - branches: [ "main" ] - workflow_dispatch: + pull_request: + branches: [ "main" ] + types: [opened, synchronize, reopened] + workflow_dispatch: jobs: KEV: name: 'KEV Policy' @@ -56,7 +57,13 @@ jobs: comment-summary-in-pr: always Sonar-Scanning: - name: Sonar Code Scanning + name: SonarQube runs-on: ubuntu-latest steps: - - run: echo "Future Location of Sonar Cube Scanner" \ No newline at end of file + - uses: actions/checkout@v5 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v6 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..8c5b1d3 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=UWHealth_react-suspended-vulnerable-application +sonar.organization=uwhealth-makerting-tech + + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=react-suspended-vulnerable-application +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 \ No newline at end of file From f35e98590cac36d3938b37d462d90482aca0db7d Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 18:12:44 -0500 Subject: [PATCH 10/11] fix: token --- .github/workflows/code_security.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code_security.yml b/.github/workflows/code_security.yml index ddef0da..5f41c58 100644 --- a/.github/workflows/code_security.yml +++ b/.github/workflows/code_security.yml @@ -66,4 +66,5 @@ jobs: - name: SonarQube Scan uses: SonarSource/sonarqube-scan-action@v6 env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + \ No newline at end of file From 4d70c9cdd8c2d91212dda88a6b49a88870ce895c Mon Sep 17 00:00:00 2001 From: Nathan Morris Date: Fri, 26 Sep 2025 18:34:44 -0500 Subject: [PATCH 11/11] fix: separate sonar --- .github/workflows/code_security.yml | 12 ------------ .github/workflows/sonarqube.yml | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/sonarqube.yml diff --git a/.github/workflows/code_security.yml b/.github/workflows/code_security.yml index 5f41c58..62faff5 100644 --- a/.github/workflows/code_security.yml +++ b/.github/workflows/code_security.yml @@ -56,15 +56,3 @@ jobs: with: comment-summary-in-pr: always - Sonar-Scanning: - name: SonarQube - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@v6 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - \ No newline at end of file diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 0000000..0a3d51c --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,20 @@ + +name: SonarQube +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + Sonar-Scanning: + name: SonarQube + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v6 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file