diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6ff518bf..82bde338 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,6 +6,9 @@ on: pull_request: branches: [main] +permissions: + contents: read + jobs: test: runs-on: ubuntu-latest @@ -15,7 +18,7 @@ jobs: egress-policy: audit - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Build containers run: docker compose build --build-arg MIX_ENV=test diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..e666af32 --- /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: ["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", "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@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@a073c66b2accf653a511d88537804dcafa07812e # v2.25.10 + 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@a073c66b2accf653a511d88537804dcafa07812e # v2.25.10 + + # ℹī¸ 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@a073c66b2accf653a511d88537804dcafa07812e # v2.25.10 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 00000000..ce491d1e --- /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@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 + with: + egress-policy: audit + + - name: 'Checkout Repository' + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + - name: 'Dependency Review' + uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 diff --git a/.github/workflows/fast-forward.yaml b/.github/workflows/fast-forward.yaml index 98817299..7f598362 100644 --- a/.github/workflows/fast-forward.yaml +++ b/.github/workflows/fast-forward.yaml @@ -4,6 +4,9 @@ on: issue_comment: types: [created, edited] +permissions: + contents: read + jobs: fast-forward: # Only run if the comment contains the /fast-forward command. @@ -22,7 +25,7 @@ jobs: egress-policy: audit - name: Fast forwarding - uses: sequoia-pgp/fast-forward@v1 + uses: sequoia-pgp/fast-forward@ea7628bedcb0b0b96e94383ada458d812fca4979 # v1.0.0 with: merge: true # To reduce the workflow's verbosity, use 'on-error' diff --git a/.github/workflows/heroku.yaml b/.github/workflows/heroku.yaml index 2c404c51..b57b1f08 100644 --- a/.github/workflows/heroku.yaml +++ b/.github/workflows/heroku.yaml @@ -22,7 +22,7 @@ jobs: egress-policy: audit # Forward deployment's status to the deployed commit. - - uses: octokit/request-action@v2.x + - uses: octokit/request-action@1f5f8ff67cfd43e6d1abe41548675d93e4f402c5 # v2.x env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -50,7 +50,7 @@ jobs: egress-policy: audit - id: health_check - uses: jtalk/url-health-check-action@v4 + uses: jtalk/url-health-check-action@b716ccb6645355dd9fcce8002ce460e5474f7f00 # v4 with: url: ${{ github.event.deployment.payload.web_url }} follow-redirect: true @@ -58,7 +58,7 @@ jobs: retry-delay: 30s continue-on-error: true # Set appropriate status to the deployed commit. - - uses: octokit/request-action@v2.x + - uses: octokit/request-action@1f5f8ff67cfd43e6d1abe41548675d93e4f402c5 # v2.x env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..723e338d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: +- 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/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 diff --git a/Dockerfile b/Dockerfile index 14671a55..f7c5d865 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Largely based on https://github.com/nicbet/docker-phoenix/blob/main/Dockerfile -FROM node:20.12.2-alpine AS node -FROM elixir:1.16-otp-26-alpine AS setup +FROM node:20.12.2-alpine@sha256:7a91aa397f2e2dfbfcdad2e2d72599f374e0b0172be1d86eeb73f1d33f36a4b2 AS node +FROM elixir:1.16-otp-26-alpine@sha256:829bebfcdc6fc58c56effc0d77f660de7c902fcf74e785b3175ee3a8f739b3f5 AS setup ### Install deps