Yelp / detect-secrets

An enterprise friendly way of detecting and preventing secrets in code.
Apache License 2.0
3.62k stars 450 forks source link

Add a plugin for EmailAddress #694

Open perryzjc opened 1 year ago

perryzjc commented 1 year ago

The code documentation has been updated to reflect these changes. The new feature is expected to enhance the system's capabilities in handling email address-related data.

riverma commented 9 months ago

FYI @KevinHock - thoughts?

lorenzodb1 commented 9 months ago

Hi @perryzjc, thank you for opening this PR. I noticed our PR checks did not run, so I'll have to figure what happened there first. Rest assured I'll get to this as soon as possible.

lorenzodb1 commented 8 months ago

@perryzjc hi again 😄 could you please merge master into your branch?

perryzjc commented 8 months ago

@perryzjc hi again 😄 could you please merge master into your branch?

@lorenzodb1 hi, I've merged the latest updates from the master branch into my feature branch as requested. Please let me know if there's anything else needed for this pull request. Thanks!

lorenzodb1 commented 8 months ago

@perryzjc looks like there's some pre-commit checks failing, please take a look

perryzjc commented 8 months ago

@perryzjc looks like there's some pre-commit checks failing, please take a look

@lorenzodb1 Thanks for letting me know. I've resolved the issues and all checks are now passing in the workflow.

perryzjc commented 8 months ago

Do you think we could add a way for someone to specify a domain so that this plugin flags only emails from that domain?

@lorenzodb1 What if we add an additional argument for the command line to specify the domains and make it the config in the baseline file?

So, instead of the usual: $ detect-secrets scan test_data/ --all-files > .secrets.baseline

We'd have something like: $ detect-secrets scan test_data/ --all-files --detect-only-domains "gmail.com,mail.example.com" > .secrets.baseline

The baseline file would then look like this:

  "plugins_used": [
    ...
    {
      "name": "EmailAddressDetector",
      "detect-only-domains": "gmail.com,mail.example.com"
    },
    ...
  ]

This setup means our pre-commit checks could catch emails based on this configuration, giving us more control.

I’m curious about your take on this. Are there any concerns regarding compatibility or implementation challenges we should be aware of?

lorenzodb1 commented 8 months ago

@perryzjc that's exactly what I was thinking. I don't think there would be compatibility issues and I can't think of any implementation challenges you might face. I'll tag @jpdakran as he can maybe come up with something

riverma commented 4 months ago

Hey @lorenzodb1 @jpdakran - just wanted to poke here as well. Hope @perryzjc contribution can be considered for merge.

lorenzodb1 commented 2 months ago

@perryzjc I just got around to review this and I wondering: do you still intend to add the --detect-only-domains flag? I think that'd be a useful one.

lorenzodb1 commented 2 months ago

@perryzjc looks like merging https://github.com/Yelp/detect-secrets/pull/692 created some conflicts in here. I'd ask you to solve these (which will also have the additional benefit of updating the PR checks, meaning it'd run checks for py3.11 too)