Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
[chore] - update docs for pre-commit (#2280)
ahravb2c0d50ba8d0
diff --git a/README.md b/README.mdindex 719802564..19d9b030e 100644--- a/README.md+++ b/README.md@@ -421,6 +421,12 @@ If you'd like to specify specific `base` and `head` refs, you can use the `base`## Pre-commit HookTrufflehog can be used in a pre-commit hook to prevent credentials from leaking before they ever leave your computer.++**Key Usage Note:**++- **For optimal hook efficacy, execute `git add` followed by `git commit` separately.** This ensures Trufflehog analyzes all intended changes.+- **Avoid using `git commit -am`, as it might bypass pre-commit hook execution for unstaged modifications.**+An example `.pre-commit-config.yaml` is provided (see [pre-commit.com](https://pre-commit.com/) for installation).```yamldiff --git a/pkg/giturl/giturl.go b/pkg/giturl/giturl.goindex 5021cdbeb..ce01c95fd 100644--- a/pkg/giturl/giturl.go+++ b/pkg/giturl/giturl.go@@ -120,7 +120,7 @@ func NormalizeOrgRepoURL(provider provider, repoURL string) (string, error) {func GenerateLink(repo, commit, file string, line int64) string {// Some paths contain '%' which breaks |url.Parse| if not encoded.// https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding- file = strings.Replace(file, "%", "%25", -1)+ file = strings.ReplaceAll(file, "%", "%25")switch determineProvider(repo) {case providerBitbucket:@@ -140,7 +140,7 @@ func GenerateLink(repo, commit, file string, line int64) string {default:var baseLink string- //Gist links are formatted differently+ // Gist links are formatted differentlyif strings.HasPrefix(repo, "https://gist.github.com") {baseLink = repo[:len(repo)-4] + "/"if commit != "" {