Skip to content

Add one-command security tools setup and pre-push scanning#1185

Open
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
feat/setup-security-tools
Open

Add one-command security tools setup and pre-push scanning#1185
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
feat/setup-security-tools

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 10, 2026

What this adds

/setup-security-tools command

One command to download and configure all three security tools:

  • AgentShield — scans Claude config for prompt injection/secrets
  • Zizmor — static analysis for GitHub Actions workflows
  • SFW (Socket Firewall) — intercepts package manager commands to block malware

Prompts for a Socket API key (enterprise features), downloads binaries with SHA-256 verification, creates PATH shims (bash + Windows .cmd).

Pre-push scanning

Adds AgentShield + zizmor blocking scans to the pre-push hook. Every push is automatically checked.

Files

  • .claude/hooks/setup-security-tools/ — setup script + README
  • .claude/commands/setup-security-tools.md — the slash command
  • .git-hooks/pre-push — updated with security pre-checks
  • .claude/skills/security-scan/SKILL.md — cross-references the hook
  • .gitignore — tracks hooks and settings

Note

Medium Risk
Medium risk because it adds a mandatory pre-push gate that can block developer pushes and introduces a script that downloads/executes platform binaries and installs PATH shims, which may affect local environments.

Overview
Adds a new /setup-security-tools command plus a .claude/hooks/setup-security-tools Node script to bootstrap AgentShield, zizmor, and Socket Firewall locally, including SHA-verified binary downloads, caching under ~/.socket/, and generation of package-manager shims (with enterprise mode enabled via SOCKET_API_KEY).

Introduces a new .git-hooks/pre-push hook that blocks pushes when AgentShield or zizmor detect issues and adds additional commit/file checks (AI attribution, secret patterns, and disallowed files). Updates .gitignore to keep .claude/hooks/ and .claude/settings.json tracked.

Reviewed by Cursor Bugbot for commit e9a48c5. Configure here.

One command to set up AgentShield, zizmor, and Socket Firewall.
Downloads binaries with SHA-256 verification, creates PATH shims
(bash + Windows .cmd), and adds blocking scans to pre-push hook.
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: SFW free shims disable SSL verification globally
    • Removed the export GIT_SSL_NO_VERIFY=true line and its comment from the sfw-free shim generation code, eliminating the global SSL verification bypass.

Create PR

Or push these changes by commenting:

@cursor push 6216e6d7db
Preview (6216e6d7db)
diff --git a/.claude/hooks/setup-security-tools/index.mts b/.claude/hooks/setup-security-tools/index.mts
--- a/.claude/hooks/setup-security-tools/index.mts
+++ b/.claude/hooks/setup-security-tools/index.mts
@@ -273,10 +273,6 @@
         'fi',
       )
     }
-    if (!isEnterprise) {
-      // Workaround: sfw-free does not yet set GIT_SSL_CAINFO (temporary).
-      bashLines.push('export GIT_SSL_NO_VERIFY=true')
-    }
     bashLines.push(`exec "${binaryPath}" "${realBin}" "$@"`)
     const bashContent = bashLines.join('\n') + '\n'
     const bashPath = path.join(shimDir, cmd)

You can send follow-ups to the cloud agent here.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e9a48c5. Configure here.

stream.on('end', () => resolve(hash.digest('hex')))
stream.on('error', reject)
})
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unused sha256File function is dead code

Low Severity

The sha256File function is defined but never called anywhere in the codebase. It also causes createReadStream to be imported unnecessarily. The actual SHA-256 verification is handled by httpDownload (via the sha256 option) and downloadBinary, making this function completely dead code.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e9a48c5. Configure here.

if (!isEnterprise) {
// Workaround: sfw-free does not yet set GIT_SSL_CAINFO (temporary).
bashLines.push('export GIT_SSL_NO_VERIFY=true')
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SFW free shims disable SSL verification globally

High Severity

The sfw-free shims inject export GIT_SSL_NO_VERIFY=true into every package manager invocation. This disables SSL certificate verification for all git operations performed by the wrapped command, exposing users to man-in-the-middle attacks. Particularly concerning for a security tool — any pip install or cargo install from a git source would skip TLS verification.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e9a48c5. Configure here.

if [ -n "$latest_release" ]; then
range="$latest_release..$local_sha"
else
range="$local_sha"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Single-SHA range breaks diff and scans all history

Medium Severity

When no remote default branch and no release tags exist, range is set to a bare $local_sha instead of a two-dot range. This causes git rev-list to enumerate the entire commit history (every ancestor), scanning all commit messages for AI attribution. It also causes git diff --name-only to compare against the working tree rather than listing changed files across commits, producing incorrect file lists for the security checks.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e9a48c5. Configure here.

latest_release=$(git tag --list 'v*' --sort=-version:refname --merged "$remote_sha" | head -1)
if [ -n "$latest_release" ]; then
# Only check commits after the latest release that are being pushed.
range="$latest_release..$local_sha"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Existing branch re-scans already-pushed commits since release

Medium Severity

For an existing branch with a release tag, range is set to $latest_release..$local_sha instead of $remote_sha..$local_sha. This includes commits that were already on the remote (between the release tag and $remote_sha), causing redundant rescanning of previously validated commits and potential false positives from old commits that cannot be fixed without rewriting public history.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e9a48c5. Configure here.

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.

1 participant