diff --git a/.github/workflows/pr-code-security.yml b/.github/workflows/pr-code-security.yml index fde10666..3448776a 100644 --- a/.github/workflows/pr-code-security.yml +++ b/.github/workflows/pr-code-security.yml @@ -4,13 +4,34 @@ on: pull_request: branches: [main] +permissions: + contents: read + jobs: secret-detection: name: Secret Detection - if: github.event_name == 'pull_request' - uses: prisma/.github/.github/workflows/secret_detection.yml@main - secrets: inherit - code-scanning: - name: Code Scanning - if: github.event_name == 'pull_request' - uses: prisma/.github/.github/workflows/code_scanning.yml@main + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + # Full history so gitleaks can scan every commit in the PR range. + fetch-depth: 0 + persist-credentials: false + # We run the gitleaks CLI directly rather than gitleaks-action: the + # action wrapper requires a paid license for repos under a GitHub + # organization, while the gitleaks binary itself is MIT-licensed and + # free. Pinned by version and verified by SHA-256 before use. + - name: Install gitleaks + env: + GITLEAKS_VERSION: 8.30.1 + GITLEAKS_SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb + run: | + set -euo pipefail + url="https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" + curl -sSfL "$url" -o gitleaks.tar.gz + echo "${GITLEAKS_SHA256} gitleaks.tar.gz" | sha256sum -c - + tar -xzf gitleaks.tar.gz gitleaks + sudo install gitleaks /usr/local/bin/gitleaks + gitleaks version + - name: Scan git history for secrets + run: gitleaks git --no-banner --redact --exit-code 1 --config .gitleaks.toml . diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 00000000..3439483e --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,10 @@ +# gitleaks config for the PR secret scan: full default rule set, with the +# self-signed TLS test fixtures under docker/certs/ allowlisted. +[extend] +useDefault = true + +[allowlist] +description = "Self-signed TLS test fixtures for the local integration-test SQL Server container" +paths = [ + '''docker/certs/.*''', +]