Skip to content

In contributing, detect-secrets command does not work in Powershell #1543

Open
@jsvobo

Description

@jsvobo

Adhering to contribution guidelines, I am updating my baseline for detect-secrets. The command detect-secrets scan --exclude-files ".*dataset/.*|(?x)(^config/local_ti_files/own_malicious_JA3.csv$|.*test.*|slips.yaml|.*\.md$)" > .secrets.baseline gives error trace ending in:
"re.error: global flags not at the start of the expression at position 13"

This is because the regex is probably wrong, (?x) is a flag and needs to be in from of the regex. ChatGPT offers 2 solutions, either put (?x) in front of the whole regex (applying the verbose flag on the whole path with dataset in front) or use a different syntax, which uses verbose mode only past the dataset/ sub path. I cannot really change it, I don't know what was the intended use. You can see proposed changes in the image below.

Image

These are the changed commands:

detect-secrets scan --exclude-files "(?x)(.*dataset/.*|^config/local_ti_files/own_malicious_JA3.csv$|.*test.*|slips.yaml|.*\.md$)" > .secrets.baseline

or

detect-secrets scan --exclude-files ".*dataset/.*|(?x:^config/local_ti_files/own_malicious_JA3.csv$|.*test.*|slips.yaml|.*\.md$)" > .secrets.baseline

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions