awslabs / awslabs/git-secrets

grep: warning: stray \ before -

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

Description

On commit, I get
```
grep: warning: stray \ before -
```
that's caused by the following pattern
```console
% git config --get-all secrets.patterns|grep ACCOUNT
("|')?(AWS|aws|Aws)?_?(ACCOUNT|account|Account)_?(ID|id|Id)?("|')?\s*(:|=>|=)\s*("|')?[0-9]{4}\-?[0-9]{4}\-?[0-9]{4}("|')?
%
```
as demonstrated by
```console
% grep -E "(\"|')?(AWS|aws|Aws)?_?(ACCOUNT|account|Account)_?(ID|id|Id)?(\"|')?\\s*(:|=>|=)\\s*(\"|')?[0-9]{4}\\-?[0-9]{4}\\-?[0-9]{4}(\"|')?"
grep: warning: stray \ before -
grep: warning: stray \ before -
```
This is on up-to-date Arch Linux and git-secrets 1.3.0 (the latest tag, from 3.5 years ago, which contains the latest master version of the git-secrets script).

Contributor guide

Open the contributing guide

Research direction

Reproduce the warning with the shown git config and grep -E commands, then inspect the git-secrets script's pattern handling and the configured secrets.patterns value. The fix is done when the AWS account pattern no longer emits the stray-backslash warning while still detecting matching credentials; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.