awslabs / git-secrets

Prevents you from committing secrets and credentials into git repositories
Apache License 2.0
12.36k stars 1.17k forks source link

Bug: password in end of file with first line in pattern file won't work #119

Open MagicJohnJang opened 5 years ago

MagicJohnJang commented 5 years ago

Environment

Win10 with git bash

Case

target secret file: test.txt (should be the end of file without newline)

password=12345

pattern file: pattern.txt (should be the first line of file)

password\s=\s.+

Apply pattern: git secrets --add-provider -- cat ./pattern.txt

Run scan: git secrets --scan

An then it'll ignore the password.

sparr commented 1 year ago
echo -n "password=12345" > test-file
echo -n "password\s*=\s*.+" > pattern-file
git secrets --add-provider -- cat ./pattern-file
git add test-file
git secrets --scan

produces:

test-file:1:password=12345

Can you describe a different test case that reproduces the problematic behavior you've observed?