{m365_defender,microsoft_defender_endpoint}.vulnerability: Handle empty response and 403 - #15749
Conversation
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
| "error": { | ||
| "code": string(resp.StatusCode), | ||
| "id": string(resp.Status), | ||
| "message": decoded_body.decode_error + ". Download URLs are likely expired.Try increasing the 'SAS Valid Hours' parameter to download more data.", |
There was a problem hiding this comment.
| "message": decoded_body.decode_error + ". Download URLs are likely expired.Try increasing the 'SAS Valid Hours' parameter to download more data.", | |
| "message": decoded_body.decode_error + ": Download URLs are likely expired. Try increasing the 'SAS Valid Hours' parameter to download more data.", |
| "error": { | ||
| "code": string(resp.StatusCode), | ||
| "id": string(resp.Status), | ||
| "message": decoded_body.decode_error + ". Download URLs are likely expired.Try increasing the 'SAS Valid Hours' parameter to download more data.", |
There was a problem hiding this comment.
| "message": decoded_body.decode_error + ". Download URLs are likely expired.Try increasing the 'SAS Valid Hours' parameter to download more data.", | |
| "message": decoded_body.decode_error + ": Download URLs are likely expired. Try increasing the 'SAS Valid Hours' parameter to download more data.", |
🚀 Benchmarks reportTo see the full report comment with |
efd6
left a comment
There was a problem hiding this comment.
nits
The alternative approach would be to check that the body is neither "" nor has a "<" prefix. Though I think that (from what I can make out from the description) will be more complex since the two things happen at different encoding levels in the response (as an aside, why do they use an XML error in a JSON API? or for that matter why explicitly gzip the body when the transport could transparently compress with exactly the same compression scheme ¯\_(ツ)_/¯.
All up, I think this is OK, mod the nits.
💚 Build Succeeded
History
cc @kcreddy |
|
Package m365_defender - 5.1.0 containing this change is available at https://epr.elastic.co/package/m365_defender/5.1.0/ |
|
Package microsoft_defender_endpoint - 4.1.2 containing this change is available at https://epr.elastic.co/package/microsoft_defender_endpoint/4.1.2/ |
…ty response and 403 (elastic#15749) {m365_defender,microsoft_defender_endpoint}.vulnerability: Handle empty response and 403 due to expired URLs. We see cases where the API sends 200 with empty ("") response when fetching vulnerabilities using SAS URLs. Since this errored-URL is not removed from CEL work_list, it leads to following errors every interval: """ failed evaluation: failed eval: ERROR: <input>:2:43: file: EOF | state.?work_list.orValue([]).size() > 0 ? | ..........................................^ """ After a while when the signatures expire (controlled with `sas_valid_hours`), following error is noticed: """ <?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:xxxxxx-xxxx-x-xxx-- Time:2025-10-20T02:07:09.6560520Z</Message><AuthenticationErrorDetail>Signature not valid in the specified key time frame: Key start [Mon, 20 Oct 2025 01:05:29 GMT] - Key expiry [Mon, 20 Oct 2025 02:05:29 GMT] - Current [Mon, 20 Oct 2025 02:07:09 GMT]</AuthenticationErrorDetail></Error> """ Handle both these cases in {m365_defender,microsoft_defender_endpoint}.vulnerability data stream by adding specific error.message asking users to increase "SAS Valid Hours" config option. Add troubleshooting section inside the documentation indicating the same. Also, bring the m365_defender.vulnerability in parity with microsoft_defender_endpoint.vulnerability data stream adding oauth endpoint options from elastic#15667.
Proposed commit message
Checklist
changelog.ymlfile.How to test this PR locally
Add/Replace the following files inside
packages/m365_defender/_dev/deploy/docker:download-vulnerability2.log.gz
vulnerability-http-mock-config.yml
Run system tests.
eval "$(elastic-package stack shellinit)" && elastic-package test system --generate -v --data-streams=vulnerabilityThis should produce
error.messageindicating users to increaseSAS Valid Hoursoption.Related issues