spark1security / n0s1

Secret Scanner for Slack, Jira, Confluence, Asana, Wrike and Linear
https://spark1.us/n0s1
GNU General Public License v3.0
38 stars 11 forks source link

Changed default regex config file to use YAML by default #5

Closed blupants closed 9 months ago

blupants commented 9 months ago

This PR changes the default regex config file to use YAML format rather than TOML. TOML is still supported but it has some limitations when dealing with some specific regexes.

This PR also bumps Python version to 3.11 (supports 3.8 and earlier)

Steps to reproduce the TOML regex issue:

curl https://raw.githubusercontent.com/gitleaks/gitleaks/master/config/gitleaks.toml -o gitleaks.toml
python3 -c 'import toml; cf=toml.load("gitleaks.toml"); print(cf)'

Notice that file gitleaks.toml is only partially loaded by python toml module.

Testing:

cd n0s1
curl https://raw.githubusercontent.com/gitleaks/gitleaks/master/config/gitleaks.toml -o gitleaks.toml
python3 ./src/n0s1/n0s1.py jira_scan --server "https://<YOUR_JIRA_SERVER>.atlassian.net" --api-key "<YOUR_JIRA_API_TOKEN>" --regex-file ./gitleaks.toml --debug
.
.
.
WARNING:root:'regex'
WARNING:root:'regex'
.
.
.
INFO:root:Done!

python3 ./src/n0s1/n0s1.py jira_scan --server "https://<YOUR_JIRA_SERVER>.atlassian.net" --api-key "<YOUR_JIRA_API_TOKEN>" --regex-file ./src/n0s1/config/gitleaks.yaml --debug
.
.
.
INFO:root:Done!

Notice that running n0s1 with "gitleaks.toml" will cause the regexes to not be loaded properly and no secrets will be matched. When using the same regexes, but loading them from "gitleaks.yaml", everything works as expected.

References: