detect-secrets icon indicating copy to clipboard operation
detect-secrets copied to clipboard

Add JSON filetype

Open hashier opened this issue 4 years ago • 0 comments

I disable the filter for the comparison, since the key/secret would be filtered out otherwise. Though, without the patch not every valid line inside JSON would be scanned.

# Current master

$ PYTHONPATH="" python3 -m detect_secrets scan test.json --disable-filter detect_secrets.filters.heuristic.is_not_alphanumeric_string | jq '.results'
{}
# My branch

$ PYTHONPATH="/src/detect-secrets/" python3 -m detect_secrets scan test.json --disable-filter detect_secrets.filters.heuristic.is_not_alphanumeric_string | jq '.results'
{
  "test.json": [
    {
      "type": "Secret Keyword",
      "filename": "test.json",
      "hashed_secret": "3c8567b928837d1264eec832a7e59fdcb9470f8b",
      "is_verified": false,
      "line_number": 2
    }
  ]
}
# file to be scanned, valid JSON

$ cat test.json
{
  "secret": 78193672857003048172616861202423,
}

hashier avatar Apr 22 '21 17:04 hashier