Skip to content

fix(hooks): use strings for binary file scanning in pre-push#1196

Open
John-David Dalton (jdalton) wants to merge 2 commits intomainfrom
fix/hooks-strings-binary-scanning
Open

fix(hooks): use strings for binary file scanning in pre-push#1196
John-David Dalton (jdalton) wants to merge 2 commits intomainfrom
fix/hooks-strings-binary-scanning

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

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

Use strings command for binary files (WASM, .lockb, etc) instead of raw grep to properly detect embedded paths and secrets.


Note

Medium Risk
Changes the pre-push secret scanning logic to treat binary files differently, which can affect detection accuracy and may alter what gets blocked during pushes. Low code footprint, but it gates all pushes and could introduce new false positives/negatives if strings/binary detection behaves unexpectedly.

Overview
Improves .git-hooks/pre-push file-content security checks by detecting binary files and scanning them via strings output instead of grepping raw bytes.

All existing detectors (personal paths, sktsec_ keys, AWS/GitHub creds, private keys) now operate on a normalized file_text stream, including for WASM and other binary artifacts, with matching lines printed from that extracted text when blocking a push.

Reviewed by Cursor Bugbot for commit 2f037d9. Configure here.

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 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

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

Reviewed by Cursor Bugbot for commit 2f037d9. Configure here.

Add || echo "" fallback to strings and cat command substitutions,
matching the existing pattern at line 137. Without this, if strings
is not installed (e.g. minimal Docker/CI images), set -e silently
aborts the script with exit 127, blocking the push with no message.
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.

2 participants