-
Notifications
You must be signed in to change notification settings - Fork 499
microsoft_defender_endpoint: add support for oauth endpoint params #15667
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
chemamartinez
wants to merge
2
commits into
elastic:main
Choose a base branch
from
chemamartinez:15605-mdefender-endpoint-oauth-endpoint-params
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.
+355
−151
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
15 changes: 15 additions & 0 deletions
15
...microsoft_defender_endpoint/data_stream/log/_dev/test/system/test-oauth-params-config.yml
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,15 @@ | ||
service: microsoft-defender-mock | ||
input: httpjson | ||
data_stream: | ||
vars: | ||
client_id: test-app-id | ||
client_secret: test-secret | ||
tenant_id: tenant_id | ||
login_url: http://{{Hostname}}:{{Port}} | ||
request_url: http://{{Hostname}}:{{Port}}/api/alerts | ||
enable_request_tracer: true | ||
oauth_endpoint_params: | | ||
grant_type: refresh_token | ||
refresh_token: 'refresh_token_123' | ||
assert: | ||
hit_count: 3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,97 @@ | ||
{ | ||
"@timestamp": "2025-09-08T14:14:17.520Z", | ||
"@timestamp": "2025-10-16T10:42:06.592Z", | ||
"agent": { | ||
"ephemeral_id": "3f082892-0f6c-45a1-aa4d-4887bd3462c8", | ||
"id": "36f3bbaf-2d4f-4f3c-af1f-4c13524514f5", | ||
"name": "elastic-agent-19107", | ||
"ephemeral_id": "b43b835d-ba25-4ad7-aa9f-200c15733e48", | ||
"id": "353e6432-27a9-40a4-98a2-557dbb69496b", | ||
"name": "elastic-agent-48674", | ||
"type": "filebeat", | ||
"version": "8.19.0" | ||
"version": "8.19.3" | ||
}, | ||
"cloud": { | ||
"account": { | ||
"id": "123543-d66c-4c7e-9e30-40034eb7c6f3" | ||
"id": "a839b112-1253-6432-9bf6-94542403f21c" | ||
}, | ||
"instance": { | ||
"id": "c5a964f417c11f6277d5bf9489f0d" | ||
"id": "111e6dd8c833c8a052ea231ec1b19adaf497b625" | ||
}, | ||
"provider": "azure" | ||
}, | ||
"data_stream": { | ||
"dataset": "microsoft_defender_endpoint.log", | ||
"namespace": "61125", | ||
"namespace": "90146", | ||
"type": "logs" | ||
}, | ||
"ecs": { | ||
"version": "8.11.0" | ||
}, | ||
"elastic_agent": { | ||
"id": "36f3bbaf-2d4f-4f3c-af1f-4c13524514f5", | ||
"id": "353e6432-27a9-40a4-98a2-557dbb69496b", | ||
"snapshot": false, | ||
"version": "8.19.0" | ||
"version": "8.19.3" | ||
}, | ||
"event": { | ||
"action": "Malware", | ||
"action": "Execution", | ||
"agent_id_status": "verified", | ||
"category": [ | ||
"host", | ||
"malware" | ||
"host" | ||
], | ||
"created": "2020-06-30T10:09:01.1569718Z", | ||
"created": "2021-01-26T20:33:57.7220239Z", | ||
"dataset": "microsoft_defender_endpoint.log", | ||
"duration": 0, | ||
"end": "2020-06-30T10:07:44.333733Z", | ||
"id": "da637291085411733957_-1043898914", | ||
"ingested": "2025-09-08T14:14:20Z", | ||
"duration": 101466100, | ||
"end": "2021-01-26T20:31:33.0577322Z", | ||
"id": "da637472900382838869_1364969609", | ||
"ingested": "2025-10-16T10:42:09Z", | ||
"kind": "alert", | ||
"provider": "defender_endpoint", | ||
"severity": 21, | ||
"start": "2020-06-30T10:07:44.333733Z", | ||
"start": "2021-01-26T20:31:32.9562661Z", | ||
"timezone": "UTC", | ||
"type": [ | ||
"end" | ||
"access", | ||
"start" | ||
] | ||
}, | ||
"file": { | ||
"name": "SB.xsl", | ||
"path": "C:\\Windows\\Temp\\sb-sim-temp-ikyxqi\\sb_10554_bs_h4qpk5" | ||
}, | ||
"host": { | ||
"hostname": "testserver4", | ||
"id": "c5a964f417c11f6277d5bf9489f0d", | ||
"name": "testserver4" | ||
"hostname": "temp123.middleeast.corp.microsoft.com", | ||
"id": "111e6dd8c833c8a052ea231ec1b19adaf497b625", | ||
"name": "temp123.middleeast.corp.microsoft.com" | ||
}, | ||
"input": { | ||
"type": "log" | ||
}, | ||
"log": { | ||
"file": { | ||
"path": "/tmp/service_logs/defender_atp-test.json.log" | ||
}, | ||
"offset": 0 | ||
"type": "httpjson" | ||
}, | ||
"message": "An active 'Exeselrun' malware was detected", | ||
"message": "Low-reputation arbitrary code executed by signed executable", | ||
"microsoft": { | ||
"defender_endpoint": { | ||
"assignedTo": "[email protected]", | ||
"evidence": { | ||
"entityType": "File" | ||
"aadUserId": "11118379-2a59-1111-ac3c-a51eb4a3c627", | ||
"accountName": "name", | ||
"domainName": "DOMAIN", | ||
"entityType": "User", | ||
"userPrincipalName": "[email protected]" | ||
}, | ||
"incidentId": "12", | ||
"investigationId": "9", | ||
"investigationState": "Benign", | ||
"lastUpdateTime": "2020-07-03T15:15:39.13Z", | ||
"resolvedTime": "2020-06-30T11:13:12.2680434Z", | ||
"status": "Resolved" | ||
"incidentId": "1126093", | ||
"investigationState": "Queued", | ||
"lastUpdateTime": "2021-01-26T20:33:59.2Z", | ||
"rbacGroupName": "A", | ||
"status": "New" | ||
} | ||
}, | ||
"observer": { | ||
"name": "WindowsDefenderAv", | ||
"name": "WindowsDefenderAtp", | ||
"product": "Defender for Endpoint", | ||
"vendor": "Microsoft" | ||
}, | ||
"related": { | ||
"hosts": [ | ||
"testserver4" | ||
"temp123.middleeast.corp.microsoft.com" | ||
], | ||
"user": [ | ||
"temp123" | ||
] | ||
}, | ||
"rule": { | ||
"description": "Malware and unwanted software are undesirable applications that perform annoying, disruptive, or harmful actions on affected machines. Some of these undesirable applications can replicate and spread from one machine to another. Others are able to receive commands from remote attackers and perform activities associated with cyber attacks.\n\nA malware is considered active if it is found running on the machine or it already has persistence mechanisms in place. Active malware detections are assigned higher severity ratings.\n\nBecause this malware was active, take precautionary measures and check for residual signs of infection." | ||
"description": "Binaries signed by Microsoft can be used to run low-reputation arbitrary code. This technique hides the execution of malicious code within a trusted process. As a result, the trusted process might exhibit suspicious behaviors, such as opening a listening port or connecting to a command-and-control (C&C) server." | ||
}, | ||
"tags": [ | ||
"microsoft-defender-endpoint", | ||
|
@@ -105,8 +101,13 @@ | |
"framework": "MITRE ATT&CK", | ||
"technique": { | ||
"name": [ | ||
"Malware" | ||
"Execution" | ||
] | ||
} | ||
}, | ||
"user": { | ||
"domain": "DOMAIN", | ||
"id": "S-1-5-21-11111607-1111760036-109187956-75141", | ||
"name": "temp123" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...osoft_defender_endpoint/data_stream/machine/_dev/test/system/test-oauth-params-config.yml
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,18 @@ | ||
input: cel | ||
service: microsoft-defender-mock | ||
vars: | ||
url: http://{{Hostname}}:{{Port}} | ||
login_url: http://{{Hostname}}:{{Port}} | ||
client_id: test-cel-client-id | ||
client_secret: test-cel-client-secret | ||
tenant_id: tenant-id | ||
oauth_endpoint_params: | | ||
grant_type: refresh_token | ||
refresh_token: 'refresh_token_123' | ||
data_stream: | ||
vars: | ||
preserve_original_event: true | ||
enable_request_tracer: true | ||
batch_size: 2 | ||
assert: | ||
hit_count: 5 |
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
18 changes: 9 additions & 9 deletions
18
packages/microsoft_defender_endpoint/data_stream/machine/sample_event.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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you confirm that the elements of the map are promoted to arrays when the config is deserialised? The final destination for the data is a
map[string][]string
, while while the data here is a map of string to string.