Skip to content

detect-secrets does not detect secrets that are base64 encoded #155

@leotizzei

Description

@leotizzei

Describe the bug
detect-secrets tool does not detect secrets that are base64 encoded

To Reproduce
Steps to reproduce the behavior:

  1. create a simple module
def main():
    print("Hello world")

if __name__ == "__main__":
    main()
  1. create a json file that contains cloud object storage secrets:
{"my-bucket-name": {"access-key-id": "my-access-key", "secret-access-key": "my-secret"} }
  1. encode it with base64:
base64 -i /path/to/json/file
  1. Assign the encoded credentials to a variable
def main():
    s = "e215LWJ1Y2tldC1uYW1lOiB7YWNjZXNzLWtleS1pZDogbXktYWNjZXNzLWtleSwgc2VjcmV0LWFjY2Vzcy1rZXk6IG15LXNlY3JldH0gfQo="
    print(s)

if __name__ == "__main__":
    main()
  1. add to the repo and commit
git add hello.py
git commit -am "message"

Expected behavior
I expected that detect-secrets tool would detect the hardcoded base64 secret

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions