From d68566576b0e741418f55715b2a1e50bdc1c3717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Wed, 16 Jul 2025 14:54:56 +0300 Subject: [PATCH 1/2] Update CodeQL workflow etc. --- .github/workflows/check_with_mesh_cli.yml | 3 + .../check_with_mesh_cli_on_localnet.yml | 3 + .../check_with_mesh_cli_on_mainnet.yml | 3 + .github/workflows/code-coverage.yml | 3 + .github/workflows/codeql-analysis.yml | 129 +++++++++++------- .github/workflows/pr-build.yml | 3 + .github/workflows/regularly_check_devnet.yml | 3 + .github/workflows/regularly_check_mainnet.yml | 3 + .github/workflows/regularly_check_testnet.yml | 3 + 9 files changed, 104 insertions(+), 49 deletions(-) diff --git a/.github/workflows/check_with_mesh_cli.yml b/.github/workflows/check_with_mesh_cli.yml index 1df101f..33e4631 100644 --- a/.github/workflows/check_with_mesh_cli.yml +++ b/.github/workflows/check_with_mesh_cli.yml @@ -3,6 +3,9 @@ name: Check with Mesh CLI (testnet) on: workflow_dispatch: +permissions: + contents: read + jobs: test-testnet: runs-on: ubuntu-latest diff --git a/.github/workflows/check_with_mesh_cli_on_localnet.yml b/.github/workflows/check_with_mesh_cli_on_localnet.yml index 1714398..2760490 100644 --- a/.github/workflows/check_with_mesh_cli_on_localnet.yml +++ b/.github/workflows/check_with_mesh_cli_on_localnet.yml @@ -3,6 +3,9 @@ name: Check with Mesh CLI (localnet) on: workflow_dispatch: +permissions: + contents: read + jobs: test-localnet: runs-on: ubuntu-latest diff --git a/.github/workflows/check_with_mesh_cli_on_mainnet.yml b/.github/workflows/check_with_mesh_cli_on_mainnet.yml index d62c9dd..380338c 100644 --- a/.github/workflows/check_with_mesh_cli_on_mainnet.yml +++ b/.github/workflows/check_with_mesh_cli_on_mainnet.yml @@ -3,6 +3,9 @@ name: Check with Mesh CLI (mainnet) on: workflow_dispatch: +permissions: + contents: read + jobs: test-mainnet: runs-on: ubuntu-latest diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 12af628..bfa5353 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -4,6 +4,9 @@ on: pull_request: workflow_dispatch: +permissions: + contents: read + jobs: build: strategy: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5e1207a..7d76c89 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,54 +1,85 @@ name: "CodeQL" on: - pull_request: - workflow_dispatch: - -permissions: - security-events: write + pull_request: + workflow_dispatch: + schedule: + - cron: "22 10 * * 3" jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: ['go'] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + 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: "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: go + build-mode: autobuild + # 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}}" diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 6ca57cd..af39fe9 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -4,6 +4,9 @@ on: pull_request: workflow_dispatch: +permissions: + contents: read + jobs: build: name: Build diff --git a/.github/workflows/regularly_check_devnet.yml b/.github/workflows/regularly_check_devnet.yml index d61b87b..ed24edd 100644 --- a/.github/workflows/regularly_check_devnet.yml +++ b/.github/workflows/regularly_check_devnet.yml @@ -5,6 +5,9 @@ on: schedule: - cron: "0 */12 * * *" +permissions: + contents: read + jobs: check-devnet: runs-on: ubuntu-latest diff --git a/.github/workflows/regularly_check_mainnet.yml b/.github/workflows/regularly_check_mainnet.yml index 9fd74e6..1dc5b54 100644 --- a/.github/workflows/regularly_check_mainnet.yml +++ b/.github/workflows/regularly_check_mainnet.yml @@ -5,6 +5,9 @@ on: schedule: - cron: "0 */12 * * *" +permissions: + contents: read + jobs: check-mainnet: runs-on: ubuntu-latest diff --git a/.github/workflows/regularly_check_testnet.yml b/.github/workflows/regularly_check_testnet.yml index 8ceddc5..5f9f126 100644 --- a/.github/workflows/regularly_check_testnet.yml +++ b/.github/workflows/regularly_check_testnet.yml @@ -3,6 +3,9 @@ name: Regularly check testnet on: workflow_dispatch: +permissions: + contents: read + jobs: check-testnet: runs-on: ubuntu-latest From 4e79ee2a03d1ce7032cdd4c9bc2e71ae62b4968e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Wed, 16 Jul 2025 15:03:59 +0300 Subject: [PATCH 2/2] Removed Code QL "advanced configuration". Default one is good. --- .github/workflows/codeql-analysis.yml | 85 --------------------------- 1 file changed, 85 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 7d76c89..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: "CodeQL" - -on: - pull_request: - workflow_dispatch: - schedule: - - cron: "22 10 * * 3" - -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: "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: go - build-mode: autobuild - # 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}}"