Error : Custom secret provider detection patterns aren't loaded when executing git secrets on windows.
- Dominant language
- Shell
- Stars
- 13.4k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hi team.
The load_patterns() function doesn't seem to add the patterns of my custom secret provider when I run a scan on windows.
The same function works fine on ubuntu / MacOS.
Here is what my .gitconfig looks like.
```
[secrets]
providers = myCustomProviderBinary
[init]
templateDir = C://Users//myuser//.git-template//git-secrets
```
Here is the output of my custom provider binary. (a bunch of detection patterns)
```
[aA][pP][iI][kK][eE][yY][[:blank:]'":=\\]{1,8}([^<$[:blank:]%][^."%$[:blank:]]{20,64}['"\\]?)[[:blank:],;}]?
(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}
(\"|')?(AWS|aws|Aws)_?(SECRET|secret|Secret)?_?(ACCESS|access|Access)?_?(KEY|key|Key)(\"|')?\s*(:|=>|=)\s*(\"|')?[A-Za-z0-9/\+=]{40}(\"|')?
(\"|')?(AWS|aws|Aws)_?(ACCOUNT|account|Account)_?(ID|id|Id)?(\"|')?\s*(:|=>|=)\s*(\"|')?[0-9]{4}\-?[0-9]{4}\-?[0-9]{4}(\"|')?
```
Here is the test secret detection that works fine on Linux/Ubuntu but simply not on Windows.
`echo 'AKIAJBRHKV6EVTTNXDHATEST' | git secrets --scan -`
As I said earlier, when executing the scan on windows (from a cmd.exe or a PS shell) the load_patterns() function does not load the patterns echo'd by the custom secret provider.
Hence the detection is not working properly.
Contributor guide
Research direction
Start by tracing load_patterns() and the custom provider execution path used by git secrets on Windows, then reproduce the scan with the shown provider output and echo command. Done means the provider's detection patterns are loaded on Windows and the sample secret is detected consistently with Ubuntu and macOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100