From 7bc9a188548df838fd1dcb8640bc022c5e6ea074 Mon Sep 17 00:00:00 2001 From: China-zoupanpan Date: Sat, 30 Nov 2024 18:22:37 +0800 Subject: [PATCH 1/3] Create dependabot.yml --- .github/dependabot.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..90ca761682 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "gradle" # See documentation for possible values + directories: + - "/utbot-intellij" + - "/utbot-framework" + schedule: + interval: "weekly" From c849889917f7f092b8dd7bbab0c33b130de15cd3 Mon Sep 17 00:00:00 2001 From: zoupanpan Date: Tue, 3 Dec 2024 14:04:44 +0800 Subject: [PATCH 2/3] modify token permission --- .github/workflows/build-and-run-tests-from-branch.yml | 5 +++++ .github/workflows/build-and-run-tests.yml | 2 ++ .github/workflows/collect-statistics.yml | 2 ++ .github/workflows/issue-to-project.yml | 2 ++ .github/workflows/night-statistics-monitoring.yml | 2 ++ .github/workflows/public-rider-plugin.yml | 2 ++ .github/workflows/publish-cli-from-branch.yml | 2 ++ .github/workflows/publish-cli-image-from-branch.yml | 2 ++ .github/workflows/publish-on-github-packages.yml | 2 ++ .github/workflows/publish-plugin-from-branch.yml | 2 ++ .github/workflows/run-chosen-tests-from-branch.yml | 2 ++ 11 files changed, 25 insertions(+) diff --git a/.github/workflows/build-and-run-tests-from-branch.yml b/.github/workflows/build-and-run-tests-from-branch.yml index 0d7155d9fb..f93be3be31 100644 --- a/.github/workflows/build-and-run-tests-from-branch.yml +++ b/.github/workflows/build-and-run-tests-from-branch.yml @@ -1,5 +1,7 @@ name: "[M] UTBot Java: build and run tests" +permissions: read-all + on: workflow_dispatch: inputs: @@ -42,6 +44,7 @@ env: jobs: prepare-matrices: + permissions: read-all runs-on: ubuntu-latest # Outputs are used for passing data to dependent jobs. outputs: @@ -72,6 +75,7 @@ jobs: framework-tests: + permissions: read-all needs: prepare-matrices # Using matrices let create multiple jobs runs based on the combinations of the variables from matrices. # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs @@ -161,6 +165,7 @@ jobs: spring-tests: + permissions: read-all runs-on: ubuntu-20.04 container: image: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0 diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml index 0779d05638..51d5a8b330 100644 --- a/.github/workflows/build-and-run-tests.yml +++ b/.github/workflows/build-and-run-tests.yml @@ -1,5 +1,7 @@ name: "UTBot Java: build and run tests" +permissions: read-all + on: push: branches: diff --git a/.github/workflows/collect-statistics.yml b/.github/workflows/collect-statistics.yml index ff10bd2906..e330927f95 100644 --- a/.github/workflows/collect-statistics.yml +++ b/.github/workflows/collect-statistics.yml @@ -1,5 +1,7 @@ name: "[M] UTBot Java: collect statistics" +permissions: read-all + on: workflow_call: inputs: diff --git a/.github/workflows/issue-to-project.yml b/.github/workflows/issue-to-project.yml index 3a0b7edb3a..fc53eb2da5 100644 --- a/.github/workflows/issue-to-project.yml +++ b/.github/workflows/issue-to-project.yml @@ -1,5 +1,7 @@ name: Add issues to UTBot Java project +permissions: read-all + on: issues: types: diff --git a/.github/workflows/night-statistics-monitoring.yml b/.github/workflows/night-statistics-monitoring.yml index 99af44d6ac..b0b134521f 100644 --- a/.github/workflows/night-statistics-monitoring.yml +++ b/.github/workflows/night-statistics-monitoring.yml @@ -1,5 +1,7 @@ name: "UTBot Java: night statistics monitoring" +permissions: read-all + on: schedule: - cron: '0 0 * * *' diff --git a/.github/workflows/public-rider-plugin.yml b/.github/workflows/public-rider-plugin.yml index a2f28de7ea..587a7cf7bb 100644 --- a/.github/workflows/public-rider-plugin.yml +++ b/.github/workflows/public-rider-plugin.yml @@ -2,6 +2,8 @@ name: Publish Rider plugin +permissions: read-all + # Controls when the action will run. Workflow runs when manually triggered using the UI # or API. on: diff --git a/.github/workflows/publish-cli-from-branch.yml b/.github/workflows/publish-cli-from-branch.yml index 0f2256a242..217407d92e 100644 --- a/.github/workflows/publish-cli-from-branch.yml +++ b/.github/workflows/publish-cli-from-branch.yml @@ -1,5 +1,7 @@ name: "[M] CLI: publish as archive" +permissions: read-all + on: workflow_call: inputs: diff --git a/.github/workflows/publish-cli-image-from-branch.yml b/.github/workflows/publish-cli-image-from-branch.yml index 1c01fb85ff..d53b47dd87 100644 --- a/.github/workflows/publish-cli-image-from-branch.yml +++ b/.github/workflows/publish-cli-image-from-branch.yml @@ -1,5 +1,7 @@ name: "[M] CLI: publish docker image" +permissions: read-all + on: workflow_call: workflow_dispatch: diff --git a/.github/workflows/publish-on-github-packages.yml b/.github/workflows/publish-on-github-packages.yml index ff3becd8f9..31bbbfd47f 100644 --- a/.github/workflows/publish-on-github-packages.yml +++ b/.github/workflows/publish-on-github-packages.yml @@ -1,5 +1,7 @@ name: "[M] Publish on GitHub Packages" +permissions: read-all + on: workflow_dispatch: inputs: diff --git a/.github/workflows/publish-plugin-from-branch.yml b/.github/workflows/publish-plugin-from-branch.yml index 755ade4a60..7fcb8c56c6 100644 --- a/.github/workflows/publish-plugin-from-branch.yml +++ b/.github/workflows/publish-plugin-from-branch.yml @@ -1,5 +1,7 @@ name: "[M] Plugin: publish as archive" +permissions: read-all + on: workflow_call: inputs: diff --git a/.github/workflows/run-chosen-tests-from-branch.yml b/.github/workflows/run-chosen-tests-from-branch.yml index e1304d5c5e..2e24f6fbd1 100644 --- a/.github/workflows/run-chosen-tests-from-branch.yml +++ b/.github/workflows/run-chosen-tests-from-branch.yml @@ -1,5 +1,7 @@ name: "[M] Run chosen tests" +permissions: read-all + on: workflow_dispatch: inputs: From d150e7c74247dac43b48b67d26691900e34c3c76 Mon Sep 17 00:00:00 2001 From: China-zoupanpan Date: Tue, 3 Dec 2024 20:21:02 +0800 Subject: [PATCH 3/3] creating codeql.yml --- .github/workflows/codeql.yml | 106 +++++++++++++++++++++++++++++++++++ 1 file changed, 106 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 0000000000..f9499a607f --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,106 @@ +# 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 0 * * 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: csharp + build-mode: none + - language: go + build-mode: autobuild + - language: java-kotlin + build-mode: autobuild + - language: javascript-typescript + build-mode: none + - language: python + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', '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 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: "17" + + # 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}}"