diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 81bae9acd..7d0767629 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,43 @@ updates: directory: "/" schedule: interval: "daily" + + - package-ecosystem: docker + directory: /ansible/roles/metrics/files/index-generator + schedule: + interval: daily + + - package-ecosystem: npm + directory: /ansible/roles/metrics/files/index-generator + schedule: + interval: daily + + - package-ecosystem: docker + directory: /ansible/roles/metrics/files/process-cloudflare + schedule: + interval: daily + + - package-ecosystem: npm + directory: /ansible/roles/metrics/files/process-cloudflare + schedule: + interval: daily + + - package-ecosystem: docker + directory: /ansible/roles/metrics/files/summaries + schedule: + interval: daily + + - package-ecosystem: npm + directory: /ansible/roles/metrics/files/summaries + schedule: + interval: daily + + - package-ecosystem: npm + directory: /tools/host-map + schedule: + interval: daily + + - package-ecosystem: npm + directory: /tools/jenkins-status + schedule: + interval: daily diff --git a/.github/workflows/certificate-check.yml b/.github/workflows/certificate-check.yml index ca0a0eb0f..5c9935061 100644 --- a/.github/workflows/certificate-check.yml +++ b/.github/workflows/certificate-check.yml @@ -17,11 +17,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout current repository - uses: actions/checkout@v4 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 with: persist-credentials: false - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 with: node-version: ${{ env.NODE_VERSION }} - name: Check web ceritificate expiry @@ -29,7 +29,7 @@ jobs: run: node tools/check-certificates/check-certificates.mjs >> $GITHUB_OUTPUT - name: Create issue if: ${{ failure() }} - uses: dblock/create-a-github-issue@v3 + uses: dblock/create-a-github-issue@866beb009af3db457e82ca98efe474969a5ebce8 # v3.1.1 with: filename: .github/workflows/certificate-check-template.md search_existing: all diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..46e872b9b --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,73 @@ +# 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: ["main"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["main"] + 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: ["javascript", "python"] + # CodeQL supports [ $supported-codeql-languages ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@fdcae64e1484d349b3366718cdfef3d404390e85 # v2.22.1 + 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@fdcae64e1484d349b3366718cdfef3d404390e85 # v2.22.1 + + # â„šī¸ 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@fdcae64e1484d349b3366718cdfef3d404390e85 # v2.22.1 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 49ee2d8ee..adaceac58 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -4,13 +4,16 @@ on: branches-ignore: - "dependabot/*" pull_request: +permissions: + contents: read + jobs: Python: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - name: Set up Python 3.7 - uses: actions/setup-python@v4 + uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 with: python-version: 3.7 - name: Install dependencies diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml new file mode 100644 index 000000000..b88abbb93 --- /dev/null +++ b/.github/workflows/scorecards.yml @@ -0,0 +1,71 @@ +# 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: ["main"] + +# 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: "Checkout code" + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + 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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + 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@fdcae64e1484d349b3366718cdfef3d404390e85 # v2.22.1 + with: + sarif_file: results.sarif diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 6b5c9f9d3..ede2134d1 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -11,13 +11,16 @@ on: - '.github/workflows/shellcheck.yml' - '.shellcheckrc' +permissions: + contents: read + jobs: shellcheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - name: ShellCheck - uses: ludeeus/action-shellcheck@2.0.0 + uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0 with: check_together: 'yes' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index ee25ffdb7..934461917 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -3,11 +3,17 @@ on: schedule: - cron: "0 0 * * *" +permissions: + contents: read + jobs: stale: + permissions: + issues: write # for actions/stale to close stale issues + pull-requests: write # for actions/stale to close stale PRs runs-on: ubuntu-latest steps: - - uses: actions/stale@v8 + - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.' diff --git a/ansible/roles/metrics/files/index-generator/Dockerfile b/ansible/roles/metrics/files/index-generator/Dockerfile index a09c63ede..be6a544a9 100644 --- a/ansible/roles/metrics/files/index-generator/Dockerfile +++ b/ansible/roles/metrics/files/index-generator/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-slim +FROM node:14-slim@sha256:198142146b4c47193348f6415da769bdb5035c16fcab051c38c256a6b48f2e1c WORKDIR /usr/src/app diff --git a/ansible/roles/metrics/files/process-cloudflare/Dockerfile b/ansible/roles/metrics/files/process-cloudflare/Dockerfile index f1f65fa73..91c140b4a 100644 --- a/ansible/roles/metrics/files/process-cloudflare/Dockerfile +++ b/ansible/roles/metrics/files/process-cloudflare/Dockerfile @@ -1,4 +1,4 @@ -FROM node:15-slim +FROM node:15-slim@sha256:ecfa754d007a069a2ffc293115927f86416beea07b779c48c0597e26d2321bbb WORKDIR /usr/src/app diff --git a/ansible/roles/metrics/files/summaries/Dockerfile b/ansible/roles/metrics/files/summaries/Dockerfile index 3fb8315d9..097e7a408 100644 --- a/ansible/roles/metrics/files/summaries/Dockerfile +++ b/ansible/roles/metrics/files/summaries/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-slim +FROM node:14-slim@sha256:198142146b4c47193348f6415da769bdb5035c16fcab051c38c256a6b48f2e1c WORKDIR /usr/src/app