eth0izzle / shhgit

Ah shhgit! Find secrets in your code. Secrets detection for your GitHub, GitLab and Bitbucket repositories.
MIT License
3.84k stars 481 forks source link

Scan path on Windows #59

Closed DloomPlz closed 4 years ago

DloomPlz commented 4 years ago

Hello !

I've found out that most of the signatures checks on path when working on a Windows doesn't work because of the specific path formatting. Example: I have a test folder containing the filepath "etc/passwd" on a Windows machine, but the path scanned by shhgit is "test\etc\passwd".

A workaround would be to modify all path checks in the config.yaml file by adding "[\\/]" where there is a single "/", so it would match either "\" or "/". Another workaround would be to modify the path before checking if it matches, with the filepath method "ToSlash()". Example: path = filepath.ToSlash(path)

ToSlash returns the result of replacing each separator character in path with a slash ('/') character. Multiple separators are replaced by multiple slashes.

Documentation: https://golang.org/pkg/path/filepath/#ToSlash

eth0izzle commented 4 years ago

Thanks @smolveau - merged!