Skip to content

Pre-Commit Hook Only Runs Successfully When --trust-local-git-config #4575

@joeleonjr

Description

@joeleonjr

Expected Behavior

The suggested command for pre-commit hooks should scan staged data before it's actually committed:

#!/bin/sh

trufflehog git file://. --since-commit HEAD --results=verified,unknown --fail

Actual Behavior

The TruffleHog output shows no data scanned ("bytes": 0). When you add the --trust-local-git-config it will work properly. Seems (partially?) related to #4553.

Steps to Reproduce

  1. Follow the steps to add a global git hook.
  2. Add a canary token to a new file. Commit it.
  3. The commit won't be blocked and you'll see no data scanned.
  4. Update the pre-commit file with --trust-local-git-config . Repeat step 2. It should catch it and block.

Environment

  • OS: OSX
  • TruffleHog v3.91.1

Additional Context

The --trust-local-git-config flag was added in #4502

CC'ing @jaydee-th

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions