diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..a506ab19ce --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + + - package-ecosystem: docker + directory: /apps/docker + schedule: + interval: daily + + - package-ecosystem: npm + directory: /deps/jsonpath + schedule: + interval: daily diff --git a/.github/workflows/add-to-project.yml b/.github/workflows/add-to-project.yml index 9221efed11..f673bed20e 100644 --- a/.github/workflows/add-to-project.yml +++ b/.github/workflows/add-to-project.yml @@ -7,98 +7,108 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +permissions: + contents: read + jobs: assign_one_project: + permissions: + repository-projects: write # for srggrs/assign-one-project-github-action to assign issues and PRs to repo project runs-on: ubuntu-latest name: Assign to One Project steps: + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + - name: Assign issues with `ChromieCraft Generic` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, 'ChromieCraft Generic') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/20' - name: Assign issues with `1-19` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '1-19') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/14' - name: Assign issues with `20-29` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '20-29') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/17' - name: Assign issues with `30-39` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '30-39') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/23' - name: Assign issues with `40-49` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '40-49') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/24' - name: Assign issues with `50-59` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '50-59') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/25' - name: Assign issues with `60` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '60') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/22' - name: Assign issues with `61-64` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '61-64') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/32' - name: Assign issues with `65-69` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '65-69') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/36' - name: Assign issues with `70` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '70') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/26' - name: Assign issues with `71-74` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '71-74') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/33' - name: Assign issues with `75-79` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '75-79') with: project: 'https://github.com/azerothcore/azerothcore-wotlk/projects/37' - name: Assign issues with `80` label to their project - uses: srggrs/assign-one-project-github-action@1.2.1 + uses: srggrs/assign-one-project-github-action@42352f30e8f3608e29350741411ab7061c953972 # 1.2.1 if: | contains(github.event.issue.labels.*.name, '80') with: diff --git a/.github/workflows/build_auth.yml b/.github/workflows/build_auth.yml index 3c276f2780..7cdd4a8824 100644 --- a/.github/workflows/build_auth.yml +++ b/.github/workflows/build_auth.yml @@ -9,6 +9,9 @@ concurrency: group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }}) cancel-in-progress: true +permissions: + contents: read + jobs: build: strategy: @@ -21,9 +24,14 @@ jobs: env: COMPILER: ${{ matrix.compiler }} steps: - - uses: actions/checkout@v2 + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 - name: Cache - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 env: cache-name: cache-auth with: diff --git a/.github/workflows/build_db.yml b/.github/workflows/build_db.yml index cc0a37a424..c52c715dcb 100644 --- a/.github/workflows/build_db.yml +++ b/.github/workflows/build_db.yml @@ -9,6 +9,9 @@ concurrency: group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }}) cancel-in-progress: true +permissions: + contents: read + jobs: build: strategy: @@ -21,9 +24,14 @@ jobs: env: COMPILER: ${{ matrix.compiler }} steps: - - uses: actions/checkout@v2 + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 - name: Cache - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 env: cache-name: cache-db with: diff --git a/.github/workflows/build_modules.yml b/.github/workflows/build_modules.yml index 437727ed4e..ab628ba55c 100644 --- a/.github/workflows/build_modules.yml +++ b/.github/workflows/build_modules.yml @@ -9,6 +9,9 @@ concurrency: group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }}) cancel-in-progress: true +permissions: + contents: read + jobs: build: strategy: @@ -21,9 +24,14 @@ jobs: env: COMPILER: ${{ matrix.compiler }} steps: - - uses: actions/checkout@v2 + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 - name: Cache - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 env: cache-name: cache-modules with: diff --git a/.github/workflows/build_tools.yml b/.github/workflows/build_tools.yml index 9d09f5db74..54f3361eac 100644 --- a/.github/workflows/build_tools.yml +++ b/.github/workflows/build_tools.yml @@ -9,6 +9,9 @@ concurrency: group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }}) cancel-in-progress: true +permissions: + contents: read + jobs: build: strategy: @@ -21,9 +24,14 @@ jobs: env: COMPILER: ${{ matrix.compiler }} steps: - - uses: actions/checkout@v2 + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 - name: Cache - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 env: cache-name: cache-tools with: diff --git a/.github/workflows/build_world.yml b/.github/workflows/build_world.yml index 9444b7bc4c..1522f9a5ff 100644 --- a/.github/workflows/build_world.yml +++ b/.github/workflows/build_world.yml @@ -9,6 +9,9 @@ concurrency: group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }}) cancel-in-progress: true +permissions: + contents: read + jobs: build: strategy: @@ -21,9 +24,14 @@ jobs: env: COMPILER: ${{ matrix.compiler }} steps: - - uses: actions/checkout@v2 + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 - name: Cache - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 env: cache-name: cache-world with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..b353dfc37c --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,78 @@ +# 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" + +on: + push: + branches: ["master"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["master"] + schedule: + - cron: "0 0 * * 1" + +permissions: + contents: read + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["cpp", "python", "typescript"] + # CodeQL supports [ $supported-codeql-languages ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3 + with: + languages: ${{ matrix.language }} + # 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. + + # 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@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3 + + # â„šī¸ 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 the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 534e183a73..42ac1adc62 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -5,10 +5,18 @@ on: - 'master' # only default branch pull_request: +permissions: + contents: read + jobs: check-codestyle: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 - name: Check core codestyle run: source ./apps/ci/ci-codestyle.sh diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000000..7b5e511880 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,27 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, +# surfacing known-vulnerable versions of the packages declared or updated in the PR. +# Once installed, if the workflow run is marked as required, +# PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - name: 'Checkout Repository' + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: 'Dependency Review' + uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml new file mode 100644 index 0000000000..a803bde1f2 --- /dev/null +++ b/.github/workflows/scorecards.yml @@ -0,0 +1,76 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '20 7 * * 2' + push: + branches: ["master"] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + contents: read + actions: read + + steps: + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - name: "Checkout code" + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecards on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3 + with: + sarif_file: results.sarif diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index 864173b24e..9bf2346844 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -9,6 +9,9 @@ concurrency: group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }}) cancel-in-progress: true +permissions: + contents: read + jobs: windows-build: strategy: @@ -18,7 +21,12 @@ jobs: env: BOOST_ROOT: C:\local\boost_1_80_0 steps: - - uses: actions/checkout@v2 + - name: Harden Runner + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 + with: + egress-policy: audit + + - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 - name: Configure OS shell: bash env: @@ -55,7 +63,7 @@ jobs: cp "/c/tools/mysql/current/lib/libmysql.dll" "env/dist" cp "/c/Program Files/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll" "env/dist" cp "/c/Program Files/OpenSSL-Win64/bin/libssl-1_1-x64.dll" "env/dist" - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1 with: name: windows-2022-MSVC17-release path: env/dist diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..ef2c0ad5cf --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,30 @@ +repos: +- repo: https://github.com/digitalpulp/pre-commit-php + rev: 1.4.0 + hooks: + - id: php-lint-all +- repo: https://github.com/gitleaks/gitleaks + rev: v8.16.3 + hooks: + - id: gitleaks +- repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 3.0.0 + hooks: + - id: shellcheck +- repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + hooks: + - id: cpplint +- repo: https://github.com/pre-commit/mirrors-eslint + rev: v8.38.0 + hooks: + - id: eslint +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/pylint-dev/pylint + rev: v2.17.2 + hooks: + - id: pylint diff --git a/apps/docker/Dockerfile b/apps/docker/Dockerfile index a425f174c2..7a778371e5 100644 --- a/apps/docker/Dockerfile +++ b/apps/docker/Dockerfile @@ -7,7 +7,7 @@ # #================================================================= -FROM ubuntu:20.04 as base +FROM ubuntu:20.04@sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2faba as base ARG USER_ID=1000 ARG GROUP_ID=1000 ARG DOCKER_USER=acore @@ -100,7 +100,7 @@ COPY --chown=$DOCKER_USER:$DOCKER_USER . /azerothcore # #================================================================= -FROM ubuntu:20.04 as servicebase +FROM ubuntu:20.04@sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2faba as servicebase ARG USER_ID=1000 ARG GROUP_ID=1000 @@ -259,7 +259,7 @@ COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/db # #================================================================= -FROM ubuntu:20.04 as client-data +FROM ubuntu:20.04@sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2faba as client-data ARG USER_ID=1000 ARG GROUP_ID=1000 ARG DOCKER_USER=acore @@ -296,7 +296,7 @@ USER $DOCKER_USER # #================================================================= -FROM ubuntu:20.04 as tools +FROM ubuntu:20.04@sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2faba as tools ARG USER_ID=1000 ARG GROUP_ID=1000 ARG DOCKER_USER=acore