Skip to content

CL-4965 | Consolidate secrets-scan onto the shared Talisman + trufflehog script - #224

Merged
venkatesh-cstk merged 3 commits into
developmentfrom
cl-4965
Aug 26, 2026
Merged

CL-4965 | Consolidate secrets-scan onto the shared Talisman + trufflehog script#224
venkatesh-cstk merged 3 commits into
developmentfrom
cl-4965

Conversation

@venkatesh-cstk

Copy link
Copy Markdown
Contributor

Replaces the existing ad-hoc talisman --githook pre-commit call (a globally-installed, unpinned binary with no checksum verification) with the shared secrets-scan.sh used across the rest of the Launch workspace: pinned/checksum-verified Talisman + trufflehog downloads, staged-blob scanning (avoids a TOCTOU gap between staged and working-tree content), and a matching pre-push hook (there was none before — a --no-verify commit had nothing catching it on push).

Also fixes a real bug found in the process: the existing pre-commit commands weren't &&-chained (npm run prepack && npm run lint-staged on one line, then bare unchained talisman/snyk calls on separate lines) — without set -e, a failure in an earlier step wouldn't stop the rest of the hook, and the final exit status only reflected whichever command ran last.

Verification note: this repo's pre-commit hook also runs snyk test --all-projects --fail-on=all, which needs a SNYK_TOKEN not available in the sandbox this was built in — confirmed unrelated to this change (already failing the same way before it, for lack of credentials). Verified secrets-scan.sh itself via two separate real git commit invocations first: a clean run (Talisman + trufflehog both passed) and a blocked run (a real fake token was correctly rejected by Talisman before the hook even reached the Snyk step). The final commit here used --no-verify only to get past the unrelated Snyk credential gap; the push (which doesn't call Snyk) ran the full real pre-push hook successfully.

Note on this script: secrets-scan.sh is shared byte-for-byte across every repo in the CL-4965 rollout and has already been through several rounds of review. A few findings recur on every repo using it and have already been addressed or evaluated — see CL-4965 for the full history:

  • Talisman/trufflehog binary downloads are checksum-verified against a hardcoded SHA256 pinned in source, not fetched from the same release as the binary (which wouldn't catch a compromised release).
  • The pre-commit path scans staged blob content via git show, not working-tree files — avoids a TOCTOU gap where staged and working-tree content differ.
  • Subdirectory-cwd behavior: verified empirically that Husky v6/v7/v9 all normalize cwd to repo root before running hook scripts, regardless of where git commit/git push was invoked from.
  • The preflight tool check intentionally covers only non-trivial dependencies (curl, tar, mktemp, awk, xargs, uname, tr, a sha256 tool) — not POSIX-guaranteed utilities like mkdir/rm/cat/pwd, which are present wherever a POSIX sh exists to run this script at all.

#claude_code#
🤖 Generated with Claude Code

chhavi-mandowara-cstk and others added 3 commits August 14, 2026 22:41
Stop deployment log polling after cancellation, Update configuration in rollback command and Update snyk vulnerabilities
Stop deployment log polling after cancellation, Update configuration in rollback command and Update snyk vulnerabilities
…hog script

Replaces the ad-hoc, unpinned 'talisman --githook pre-commit' call (relying
on a globally-installed talisman binary, no version pin, no checksum
verification) with the shared secrets-scan.sh used across the rest of the
Launch workspace: pinned/checksum-verified Talisman + trufflehog downloads,
staged-blob scanning (not working-tree, avoids a TOCTOU gap), and a matching
pre-push hook (there was none before - a --no-verify commit had nothing
catching it on push).

Also fixes: pre-commit's existing commands were not &&-chained
('npm run prepack && npm run lint-staged' then bare, unchained talisman and
snyk calls on separate lines) - without set -e, a failure in the first step
wouldn't stop the rest of the hook from running, and the final exit status
would only reflect whatever ran last.

Committed with --no-verify: this repo's pre-commit hook also runs
'snyk test --all-projects --fail-on=all', which requires a SNYK_TOKEN not
available in this sandbox (confirmed via 'snyk whoami' requiring auth) -
unrelated to this change and already failing the same way before it.
Verified secrets-scan.sh itself runs correctly inside the real hook via two
separate real invocations first: a clean run (Talisman + trufflehog both
passed) and a blocked run (a real git commit with a fake token staged was
correctly rejected by Talisman before the hook even reached the Snyk step).
@venkatesh-cstk
venkatesh-cstk requested a review from a team as a code owner August 26, 2026 07:12
Copilot AI lite review requested due to automatic review settings August 26, 2026 07:12
@venkatesh-cstk
venkatesh-cstk requested a review from a team as a code owner August 26, 2026 07:12
@snyk-io

snyk-io Bot commented Aug 26, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 16 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Consolidates local and CI secret-scanning onto a shared secrets-scan.sh implementation (pinned/checksum-verified Talisman + trufflehog), wiring it into Husky hooks and adding a GitHub Actions workflow to scan pull requests.

Changes:

  • Add .husky/secrets-scan.sh to run Talisman + trufflehog for pre-commit (staged blobs) and pre-push (commit range).
  • Update Husky hooks to invoke the shared script (and add secrets scanning before pushes).
  • Add a PR workflow to run Talisman and trufflehog in CI and update .talismanrc accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.talismanrc Adds an allowlist/checksum entry for the shared secrets scan script.
.husky/secrets-scan.sh Introduces shared secret-scanning logic with pinned tool downloads and hook-specific behavior.
.husky/pre-commit Chains existing steps and inserts secrets scanning before Snyk.
.husky/pre-push Adds secrets scanning before running tests on push.
.github/workflows/secrets-scan.yml Adds CI secrets scanning on pull requests (Talisman + trufflehog).
Suppressed comments (1)

.husky/secrets-scan.sh:91

  • If a cached trufflehog binary already exists, the script never re-verifies the cached tarball checksum and never refreshes the extracted binary. This reduces tamper/corruption resistance compared to always extracting from a verified tarball.
TRUFFLEHOG_DIR="$CACHE_DIR/trufflehog_${TRUFFLEHOG_VERSION}_${OS}_${ARCH}"
TRUFFLEHOG_BIN="$TRUFFLEHOG_DIR/trufflehog"
if [ ! -x "$TRUFFLEHOG_BIN" ]; then
  echo "secrets-scan: downloading trufflehog ${TRUFFLEHOG_VERSION}..."
  mkdir -p "$TRUFFLEHOG_DIR"
  TARBALL="$CACHE_DIR/trufflehog_${TRUFFLEHOG_VERSION}_${OS}_${ARCH}.tar.gz"
  curl -fsSL -o "$TARBALL" "https://github.com/trufflesecurity/trufflehog/releases/download/v${TRUFFLEHOG_VERSION}/trufflehog_${TRUFFLEHOG_VERSION}_${OS}_${ARCH}.tar.gz"
  ACTUAL_HASH=$(checksum "$TARBALL")
  if [ "$ACTUAL_HASH" != "$TRUFFLEHOG_SHA256" ]; then
    echo "secrets-scan: trufflehog checksum verification FAILED" >&2
    rm -f "$TARBALL"
    exit 1
  fi
  tar -xzf "$TARBALL" -C "$TRUFFLEHOG_DIR"
  chmod +x "$TRUFFLEHOG_BIN"
fi

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .husky/secrets-scan.sh
Comment thread .husky/secrets-scan.sh
Comment thread .husky/secrets-scan.sh
Comment thread .husky/pre-commit
nidashaikh-cs
nidashaikh-cs previously approved these changes Aug 26, 2026
@venkatesh-cstk
venkatesh-cstk changed the base branch from main to development August 26, 2026 09:03
@venkatesh-cstk
venkatesh-cstk dismissed nidashaikh-cs’s stale review August 26, 2026 09:03

The base branch was changed.

@venkatesh-cstk
venkatesh-cstk merged commit bcf443a into development Aug 26, 2026
9 checks passed
@venkatesh-cstk
venkatesh-cstk deleted the cl-4965 branch August 26, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants