Skip to content

Duplicate Detections for Private Keys #30

@meme-lord

Description

@meme-lord

I was using a tool that uses regexes from this repo and noticed there was some duplication.
In rules-stable.yml:

  • Generic - 1702 - BEGIN RSA PRIVATE KEY
  • RSA private key - -----BEGIN RSA PRIVATE KEY-----
  • Asymmetric Private Key - -----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----
  • private_key - -----(?:(?:BEGIN|END) )(?:(?:EC|PGP|DSA|RSA|OPENSSH).)?PRIVATE.KEY(.BLOCK)?-----

These will all match on "-----BEGIN RSA PRIVATE KEY-----"
Is there some motivation behind this duplication or could it be organized better?

"Asymmetric Private Key" and "private_key" could be merged into one regex without losing anything. There is a question if you want to keep a regex for all private keys as a whole or divide it into more specific matchers for each one or if the current duplication is what you want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions