Skip to content

Commit

Permalink
Validate outlook.office365 FQDN in webhook URLs
Browse files Browse the repository at this point in the history
Based on research/testing, it appears that both of these two
FQDNs are interchangeable:

- outlook.office.com
- outlook.office365.com

This commit updates the isValidWebhookURL validation
function to accept either one as a valid webhook prefix.

refs dasrick#3
  • Loading branch information
atc0005 committed Mar 24, 2020
1 parent feea812 commit d5bf5e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions send.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ func isValidWebhookURL(webhookURL string) (bool, error) {
return false, err
}
// only pass MS teams webhook URLs
hasPrefix := strings.HasPrefix(webhookURL, "https://outlook.office.com/webhook/")
if !hasPrefix {
switch {
case strings.HasPrefix(webhookURL, "https://outlook.office.com/webhook/"):
case strings.HasPrefix(webhookURL, "https://outlook.office365.com/webhook/"):
default:
err = errors.New("unvalid ms teams webhook url")
return false, err
}
Expand Down

0 comments on commit d5bf5e1

Please sign in to comment.