Repository navigation
Microsoft Defender: work without advanced hunting (PLUG-4744) #163
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
Open
vinbab
wants to merge
16
commits into
main
Choose a base branch
from
work/vb/plug-4744
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+883
β771
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1d36d4e
feat(MicrosoftDefender): work without advanced hunting (PLUG-4744)
claude 356e29a
docs(MicrosoftDefender): scope app permissions and advanced hunting lβ¦
claude 276c96e
feat(MicrosoftDefender): vulnerability exposures without advanced hunβ¦
claude ae06cee
fix(MicrosoftDefender): issue both API tokens from the pre-request scβ¦
claude b658786
fix(MicrosoftDefender): request tokens from login.microsoft.com
claude 424e21b
fix(MicrosoftDefender): valid alert status filter and clear vulnerabiβ¦
claude f1f10ad
fix(MicrosoftDefender): scope the Vulnerability Exposure dashboard toβ¦
claude e944a71
feat(MicrosoftDefender): say what each stream needs, and explain Grapβ¦
claude b00b609
revert(MicrosoftDefender): hold back vulnerability data without advanβ¦
claude 2779940
fix(MicrosoftDefender): name the missing table and both causes of a 403
claude 21c022a
fix(MicrosoftDefender): count all active alerts on Overview
claude 4bf96c3
fix(MicrosoftDefender): add credentials hint to the advanced hunting β¦
claude 0cb8a79
fix(MicrosoftDefender): scope Overview and Incidents dashboards to hiβ¦
claude 3aaefca
fix(MicrosoftDefender): count incidents by status and show top incideβ¦
claude 43458fd
fix(MicrosoftDefender): read-only permission hint and full device expβ¦
claude 414479c
fix(MicrosoftDefender): label devices with no exposure level
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
5 changes: 3 additions & 2 deletions
5
plugins/MicrosoftDefender/v1/dataStreams/Vulnerabilities.json
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
5 changes: 3 additions & 2 deletions
5
plugins/MicrosoftDefender/v1/dataStreams/advancedHuntingQuery.json
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
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
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
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
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
5 changes: 3 additions & 2 deletions
5
plugins/MicrosoftDefender/v1/dataStreams/recommendations.json
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
39 changes: 39 additions & 0 deletions
39
plugins/MicrosoftDefender/v1/dataStreams/scripts/errorHandling/microsoftGraphApi.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Errors from streams that call Microsoft Graph. The common failures are licence and permission | ||
| // gaps rather than faults, so name what is missing instead of passing on the raw Graph error. | ||
| const error = (data && data.error) || {}; | ||
| const apiMessage = typeof error.message === "string" ? error.message : ""; | ||
|
|
||
| // Advanced hunting runs, but the tenant's licences don't include the table the query reads. | ||
| // Device tables (DeviceInfo, DeviceTvm...) need Defender for Endpoint Plan 2 or equivalent. | ||
| const missingTable = apiMessage.match(/Failed to resolve table or column expression named '([^']+)'/); | ||
|
|
||
| if (missingTable && missingTable[1].startsWith("Device")) { | ||
| // Name the table: a typo in a custom query fails the same way as a missing licence. | ||
| result = | ||
| "The advanced hunting table '" + | ||
| missingTable[1] + | ||
| "' isn't available. If the name is right, your Microsoft Defender licence doesn't include " + | ||
| "advanced hunting on device data, such as Microsoft Defender for Endpoint Plan 2. " + | ||
| "The Overview and Incidents dashboards work without it."; | ||
| } else if (missingTable) { | ||
| result = | ||
| "The advanced hunting table '" + | ||
| missingTable[1] + | ||
| "' isn't available in this tenant. The tables you can query depend on your Microsoft Defender licences."; | ||
| } else if (response.status === 401) { | ||
| result = | ||
| "Microsoft Graph rejected the credentials (HTTP 401). Check the tenant ID, client ID and client secret, " + | ||
| "and that the secret has not expired."; | ||
| } else if (response.status === 403) { | ||
| // Graph names the missing role in its message, for example "API required roles: ThreatHunting.Read.All". | ||
| result = | ||
| "Microsoft Graph refused access to this data (HTTP 403). Grant the missing application permission " + | ||
| "in Microsoft Entra ID with admin consent, and check the tenant has a licence that includes this data." + | ||
| (apiMessage ? " " + apiMessage : "") + | ||
| // Always list the read-only roles: Secure Score's 403 names none, and Graph lists read and | ||
| // write roles side by side for alerts and incidents, where read-only is enough. | ||
| " Read-only permissions are enough: alerts need SecurityAlert.Read.All, incidents " + | ||
| "SecurityIncident.Read.All, Secure Score SecurityEvents.Read.All, and advanced hunting ThreatHunting.Read.All."; | ||
| } else { | ||
| result = apiMessage || "Microsoft Graph returned HTTP " + response.status; | ||
| } | ||
5 changes: 3 additions & 2 deletions
5
plugins/MicrosoftDefender/v1/dataStreams/secureScoreHistory.json
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.