[INS-456] Add Microsoft Teams Webhook V2 detector#4902
Open
mustansir14 wants to merge 3 commits intomainfrom
Open
[INS-456] Add Microsoft Teams Webhook V2 detector#4902mustansir14 wants to merge 3 commits intomainfrom
mustansir14 wants to merge 3 commits intomainfrom
Conversation
shahzadhaider1
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Microsoft has introduced a new webhook format for Teams based on Power Automate workflows. The old format (
*.webhook.office.com/webhookb2/...) is being replaced by Power Automate trigger URLs hosted on*.environment.api.powerplatform.com. This PR adds a v2 detector for the new URL format and restructures the existing detector into a versioned layout.Motivation
Highlighted by #2693. The underlying v1 issue cannot be fully resolved since Microsoft has deprecated the old Incoming Webhook connector format and new v1 webhooks can no longer be generated. This PR adds support for the replacement Power Automate format.
Changes
New:
pkg/detectors/microsoftteamswebhook/v2/[^\s"'<>]+) so that parameter ordering changes do not break detection.sigPat) requires thesigparameter to be present anywhere in the query string — without it the URL is not a valid credential.POSTwith{"text":"hi from trufflehog"}(intentionally omits"type"so the flow accepts the request without delivering a message to the channel). Status mapping:202→ verified,400/401→ unverified, other → verification error.CustomFalsePositiveCheckerreturningfalse— Power Automate URLs contain common English words (default,invoke,run, etc.) that would otherwise be suppressed by the engine's wordlist filter.DetectorType_MicrosoftTeamsWebhook = 114withVersion() int { return 2 }.Restructured:
pkg/detectors/microsoftteamswebhook/v1/v1/subdirectory to match the convention used by other versioned detectors (e.g.atlassian/v1,atlassian/v2).Version() int { return 1 }anddetectors.Versionerinterface assertion."version"field toExtraData.//go:build detectorsbuild tag on the integration test (had been inadvertently stripped).Updated:
pkg/engine/defaults/defaults.gomicrosoftteamswebhookimport with aliasedmicrosoftteamswebhookv1andmicrosoftteamswebhookv2imports.Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Medium Risk
Introduces a new URL-matching and remote verification path that can affect scan results (false positives/negatives) and increases outbound verification traffic for Teams webhook candidates.
Overview
Adds a new
microsoftteamswebhookv2 detector to identify and optionally verify the new Power Automate workflow webhook URLs on*.environment.api.powerplatform.com, including query-stringsigenforcement and a verification POST that treats202as valid and400/401as invalid.Restructures the existing Teams webhook detector as v1 by implementing
detectors.Versionerand attaching aversionfield to results, and updatesdefaults.goto register bothmicrosoftteamswebhook/v1and/v2scanners so both formats are detected.Reviewed by Cursor Bugbot for commit 85c763f. Bugbot is set up for automated code reviews on this repo. Configure here.