awslabs / awslabs/git-secrets

Maybe word-regexp is not needed?

Open
#68 3 comments 0 reactions 0 assignees View on GitHub
aged
Dominant language
Shell
Stars
13.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Hi, I've just tried `git secrets` and it took me quite a while to understand what my regex is not working.

For example:
```
engine = create_engine('postgresql://admin:password@db-url/db-name')
```

And from `man grep`:
```
-w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent
character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.
```

And I've used this regex `postgresql:\/\/[a-z]*_(ro|rw|admin):[a-z0-9]+@`, which was not working.

Maybe I don't understand, but it seems that with `-w` grep care about the code context.
But I think `git secrets` should not care about entire line, but only about matching regex in the line.

Thanks, you've created very helpful tool

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.