Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Artifactory / Slack Patterns #195

Merged
merged 1 commit into from
Jun 19, 2019

Conversation

adrianbn
Copy link
Contributor

The modifications in this PR are twofold:

  1. Add ability to detect Slack Webhooks
  2. Improved the Artifactory password regex to catch passwords of different lengths and rotated passwords (Third char increments after user rotates password).

@@ -10,8 +10,16 @@

class SlackDetector(RegexBasedDetector):

secret_type = 'Slack Token'
secret_type = 'Slack Token / Webhook'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be a non-backwards compatible change.

Are you sure you want to do this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Backwards compatibility aside)

I think we may want to make a different plugin, I say this because we should only have 1 verify method once #194 is merged, and verifying token's vs. webhooks is different.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with having the same plugin.

In the verify method, we can do:

def verify(self, token):
    if token.startswith('https://hooks.slack.com'):
        # do logic

Copy link
Collaborator

@KevinHock KevinHock Jun 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as backwards compatibility, I don't mind but there may be a user that does. Slack isn't one of the noisier plugins so I'd say this is okay :) What do you think @domanchi?

(To explain better, the reason this breaks backwards compatibility is because all of a user's old acknowledged Slack tokens will be re-alerted on, because the "hashed_secret" value will change.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor of the slightly less descriptive, but more compatible decision to keep secret_type. IMO, adding the clarity that it also catches webhooks is less important.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would agree with @domanchi on more compatible approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objection here. I'll leave the type as it was.

re.compile(r'(\s|=|:|"|^)AP6\w{10,}'), # password
re.compile(r'(\s|=|:|"|^)AKC[a-zA-Z0-9]{10,}'), # api token
# artifactory encrypted passwords begin with AP[A-Z]
re.compile(r'(\s|=|:|"|^)AP[\dABCDEF][a-zA-Z0-9]{8,}'), # password
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @justineyster just as a heads up

The modifications in this PR are twofold:

1. Add ability to detect Slack Webhooks
2. Improved the artifactory password regex to catch passwords of
different lengths and rotated passwords (Third char increments after
user rotates password).

Restore slack token secret type
@adrianbn
Copy link
Contributor Author

I've returned the secret type and rebased master. Let me know if there are further changes you want :)

Copy link
Collaborator

@KevinHock KevinHock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅🛳

@KevinHock KevinHock merged commit a7daccc into Yelp:master Jun 19, 2019
killuazhu pushed a commit to IBM/detect-secrets that referenced this pull request May 28, 2020
* Fix Artifactory validation failure case

Closes git-defenders/detect-secrets-discuss#207

* update tests

* Catch 401 and 403
killuazhu pushed a commit to IBM/detect-secrets that referenced this pull request Jul 9, 2020
* Fix Artifactory validation failure case

Closes git-defenders/detect-secrets-discuss#207

* update tests

* Catch 401 and 403
killuazhu pushed a commit to IBM/detect-secrets that referenced this pull request Sep 17, 2020
Supports git-defenders/detect-secrets-discuss#173

Fix Artifactory validation failure case (Yelp#195)

Closes git-defenders/detect-secrets-discuss#207

Fix Artifactory regex to no longer match assignment character (Yelp#197)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants