nosecretsv0.4.0

← All examples

A typo in the configuration stops the scan

An unknown key is an error with the allowed names, and the exit status is 2, not 1. A broken configuration can no longer pass as "no findings".

A typo in the configuration stops the scan

site/captures/usecases/bad-config/
# .nosecrets.toml
[entropy]
treshold = 4.5

# deploy.py
import requests

GITHUB_TOKEN = "ghp_R2kT9xLm4Qv7Bn3Zc8Wd5Hf1Jg6Ys0AaPeXq"

def release(version):
    return requests.post(
        "https://api.github.com/repos/acme/app/releases",
        headers={"Authorization": f"token {GITHUB_TOKEN}"},
        json={"tag_name": version},
    )
$ git add deploy.py
$ nosecrets scan --staged
Error: failed to parse .nosecrets.toml: TOML parse error at line 2, column 1
  |
2 | treshold = 4.5
  | ^^^^^^^^
unknown field `treshold`, expected one of `enabled`, `min_length`, `threshold`, `require_context`, `allow`

$ echo $?
2
  • exit 2
  • strict configuration