awslabs / awslabs/git-secrets

`git secrets --list` returns wrong result if there's a branch with name ending with `secrets`

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

Description

* version: 5e28df337746db4f070c84f7069d365bfd0d72a8

When there's `secrets` branch for example, `.git/config` may contains the following lines:

```
[branch "secrets"]
remote = origin
merge = refs/heads/secrets
```

If so, `git secrets --list` returns these config incorrectly:

```
$ git secrets --list
branch.secrets.remote origin
branch.secrets.merge refs/heads/secrets
...
```

It seems to be caused by the following regexes:

https://github.com/awslabs/git-secrets/blob/5e28df337746db4f070c84f7069d365bfd0d72a8/git-secrets#L340-L343

Contributor guide

Open the contributing guide

Research direction

Start in the git-secrets script at the regexes linked around lines 340-343. Reproduce the issue with a branch named secrets and run git secrets --list to inspect the incorrect branch configuration. Done means branch-related config is excluded while valid secret-related configuration remains listed.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.