Skip to content

Commit

Permalink
Update slack webhook detector string check (#932)
Browse files Browse the repository at this point in the history
* Update slack webhook detector check to text.

* remove redunant slashes.
  • Loading branch information
ahrav authored Nov 21, 2022
1 parent 6e25664 commit 054e98d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/detectors/slackwebhook/slackwebhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
client = common.SaneHttpClient()

// Make sure that your group is surrounded in boundary characters such as below to reduce false positives.
keyPat = regexp.MustCompile(`(https:\/\/hooks\.slack\.com\/services\/[A-Za-z0-9+\/]{44,46})`)
keyPat = regexp.MustCompile(`(https://hooks\.slack\.com/services/[A-Za-z0-9+/]{44,46})`)
)

// Keywords are used for efficiently pre-filtering chunks.
Expand Down Expand Up @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
continue
}
body := string(bodyBytes)
if (res.StatusCode >= 200 && res.StatusCode < 300) || (res.StatusCode == 400 && strings.Contains(body, "missing_text")) {
if (res.StatusCode >= 200 && res.StatusCode < 300) || (res.StatusCode == 400 && strings.Contains(body, "text")) {
s1.Verified = true
}
}
Expand Down

0 comments on commit 054e98d

Please sign in to comment.