gitleaks / gitleaks

Protect and discover secrets using Gitleaks 🔑

Home Page:https://gitleaks.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for matching JWK private key

AnthonyPoschen opened this issue · comments

Is your feature request related to a problem? Please describe.
discovered JWK's in source code wrote a custom rule to match them

Describe the solution you'd like
my custom rule added for everyone else as a default rule.

Describe alternatives you've considered
None. if it isn't worth it close the ticket.

Additional context

[[rules]]
    id    = "JWK private keys"
    regex = '''\{(?:\\"|")kty(?:\\"|"):(?:\\"|")(.*?)(?:\\"|"),(?:\\"|")n(?:\\"|"):(?:\\"|")(.*?)(?:\\"|"),(?:\\"|")e(?:\\"|"):(?:\\"|")(.*?)(?:\\"|"),(?:\\"|")d(?:\\"|"):(?:\\"|")(.*?)(?:\\"|"),(?:\\"|")p(?:\\"|"):(?:\\"|")(.*?)(?:\\"|"),(?:\\"|")q(?:\\"|"):(?:\\"|")(.*?)(?:\\"|"),(?:\\"|")dp(?:\\"|"):(?:\\"|")(.*?)(?:\\"|"),(?:\\"|")dq(?:\\"|"):(?:\\"|")(.*?)(?:\\"|"),(?:\\"|")qi(?:\\"|"):(?:\\"|")(.*?)(?:\\"|")\}'''

https://phpseclib.com/docs/rsa-keys#private-keys-3

cc @zricethezav