From e0aad607eaaf50ec3b2d16243ef43ed167c05ec2 Mon Sep 17 00:00:00 2001 From: Harshi-Shah-CS Date: Thu, 29 Oct 2026 21:33:14 +0530 Subject: [PATCH] chore(hooks): add ggshield secret scan to husky hooks and drop secrets-scan workflow (+Claude) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitGuardian's remote GitHub check already scans every PR, so the secrets-scan.yml workflow is redundant; remove it and its .talismanrc entry. Add Contentstack Security's standard ggshield block to the top of .husky/pre-commit and .husky/pre-push. launch-cli is public, so a missing ggshield warns instead of blocking; a secret ggshield finds still blocks. pre-push reads the pushed refs once and pipes them to both ggshield and secrets-scan.sh, since each reads stdin and the second would otherwise get nothing and skip the Talisman/trufflehog scan. Both hook files get a .talismanrc checksum: Talisman flags the setup-URL warning line. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/secrets-scan.yml | 40 ------------------------------ .husky/pre-commit | 10 ++++++++ .husky/pre-push | 14 ++++++++++- .talismanrc | 7 +++--- 4 files changed, 27 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/secrets-scan.yml diff --git a/.github/workflows/secrets-scan.yml b/.github/workflows/secrets-scan.yml deleted file mode 100644 index de4d205e..00000000 --- a/.github/workflows/secrets-scan.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Secrets Scan - -on: - pull_request: - types: [opened, synchronize, reopened] - -permissions: - contents: read - -jobs: - secrets-scan: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Run Talisman - env: - TALISMAN_VERSION: v1.37.0 - # Pinned from https://github.com/thoughtworks/talisman/releases/download/v1.37.0/checksums - - # committed here rather than fetched at runtime, since fetching the checksums file from the - # same release as the binary it's meant to verify wouldn't catch a compromised release. - TALISMAN_SHA256: 8e0ae8bb7b160bf10c4fa1448beb04a32a35e63505b3dddff74a092bccaaa7e4 - run: | - set -euo pipefail - curl -fsSL -o talisman_linux_amd64 "https://github.com/thoughtworks/talisman/releases/download/${TALISMAN_VERSION}/talisman_linux_amd64" - echo "${TALISMAN_SHA256} talisman_linux_amd64" | sha256sum -c - - chmod +x talisman_linux_amd64 - echo "refs/heads/${{ github.head_ref }} ${{ github.event.pull_request.head.sha }} refs/heads/${{ github.base_ref }} ${{ github.event.pull_request.base.sha }}" | ./talisman_linux_amd64 --githook pre-push - - - name: TruffleHog OSS - uses: trufflesecurity/trufflehog@6f3c981e7b77f235fd2702dd74af25fc4b72bf11 # v3.96.0 - with: - path: ./ - base: ${{ github.event.pull_request.base.sha }} - head: ${{ github.event.pull_request.head.sha }} - extra_args: --results=verified,unverified,unknown diff --git a/.husky/pre-commit b/.husky/pre-commit index ce909794..e377725a 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,3 +1,13 @@ +# >>> GitGuardian secret scan (managed by Contentstack Security) >>> +if [ -z "${CI:-}" ]; then + if ! command -v ggshield >/dev/null 2>&1; then + echo "ggshield is not installed - secret scanning is skipped. Setup: https://contentstack.atlassian.net/wiki/x/FIDVEwE" >&2 + else + ggshield secret scan pre-commit || exit 1 + fi +fi +# <<< GitGuardian secret scan <<< + npm run prepack && npm run lint-staged && \ echo "\n\n Running secrets scan (Talisman + trufflehog)..." && \ sh .husky/secrets-scan.sh pre-commit && \ diff --git a/.husky/pre-push b/.husky/pre-push index afada158..3d36d4a2 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1 +1,13 @@ -sh .husky/secrets-scan.sh pre-push "$@" && npm run test +PUSH_REFS=$(cat) + +# >>> GitGuardian secret scan (managed by Contentstack Security) >>> +if [ -z "${CI:-}" ]; then + if ! command -v ggshield >/dev/null 2>&1; then + echo "ggshield is not installed - secret scanning is skipped. Setup: https://contentstack.atlassian.net/wiki/x/FIDVEwE" >&2 + else + printf '%s\n' "$PUSH_REFS" | ggshield secret scan pre-push "$@" || exit 1 + fi +fi +# <<< GitGuardian secret scan <<< + +printf '%s\n' "$PUSH_REFS" | sh .husky/secrets-scan.sh pre-push "$@" && npm run test diff --git a/.talismanrc b/.talismanrc index 75b376b3..d59b6132 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,9 +1,10 @@ fileignoreconfig: -- filename: .github/workflows/secrets-scan.yml - ignore_detectors: - - filecontent - filename: .husky/secrets-scan.sh checksum: 5a44edca8d209ca4b7f6eefc4ce2caab838679f8916ef6136ad68584c0705cb6 +- filename: .husky/pre-commit + checksum: 681362ac039289a4ef9c4e8beaca1bed0fdf9c8e82d67e8f5272ce72f3b98791 +- filename: .husky/pre-push + checksum: bb742a55c6e18d0d02da5269e8b0cdac15bc4afbbde5794df9ebb90adc363d3f - filename: src/commands/launch/index.test.ts checksum: 9db6c02ad35a0367343cd753b916dd64db4a9efd24838201d2e1113ed19c9b62 - filename: src/commands/launch/rollback.test.ts