Skip to content

fix(m365_defender): propagate state variables on error - #14722

Merged
StacieClark-Elastic merged 5 commits into
elastic:mainfrom
StacieClark-Elastic:bugfix/m365-defender-failed-request-recovery
Jul 30, 2025
Merged

fix(m365_defender): propagate state variables on error#14722
StacieClark-Elastic merged 5 commits into
elastic:mainfrom
StacieClark-Elastic:bugfix/m365-defender-failed-request-recovery

Conversation

@StacieClark-Elastic

Copy link
Copy Markdown
Contributor

Proposed commit message

Enhanced error handling in the CEL program to prevent "no such key: product_batch_size'" errors by ensuring proper propagation of the state data configuration during failures. This was accomplished by wrapping the objects returned from errors with state.with()

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices
@StacieClark-Elastic
StacieClark-Elastic requested a review from a team as a code owner July 28, 2025 23:02
@StacieClark-Elastic StacieClark-Elastic added Integration:m365_defender Microsoft Defender XDR bugfix Pull request that fixes a bug issue Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] labels Jul 28, 2025
@elasticmachine

Copy link
Copy Markdown

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@StacieClark-Elastic
StacieClark-Elastic force-pushed the bugfix/m365-defender-failed-request-recovery branch from fb352df to 42f4f61 Compare July 28, 2025 23:02
@StacieClark-Elastic
StacieClark-Elastic marked this pull request as draft July 28, 2025 23:17
@StacieClark-Elastic
StacieClark-Elastic force-pushed the bugfix/m365-defender-failed-request-recovery branch from a261c20 to 7ad062a Compare July 29, 2025 15:59
@StacieClark-Elastic
StacieClark-Elastic marked this pull request as ready for review July 29, 2025 16:00
@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

🚀 Benchmarks report

Package m365_defender 👍(3) 💚(0) 💔(1)

Expand to view
Data stream Previous EPS New EPS Diff (%) Result
vulnerability 2145.92 1730.1 -415.82 (-19.38%) 💔

To see the full report comment with /test benchmark fullreport

@chrisberkhout chrisberkhout left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Some suggestions about closing things at the level of indentation at which they were opened.

Comment on lines +104 to +105
}
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
)
})

Avoids a half indentation and make it clearer that the following ) closes the .as( in line 63.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used celfmt on the entire file. It won't allow ({ or }). This causes some changes on lines that weren't changed but it follows the convention that celfmt sets.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, celfmt doesn't have the best taste, but it has simple taste. These no longer cuddle.

Comment on lines +169 to +170
}
)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used celfmt on the entire file. It won't allow ({ or }). This causes some changes on lines that weren't changed but it follows the convention that celfmt sets.

Comment on lines 236 to 252
}
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
)
})

And here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used celfmt on the entire file. It won't allow ({ or }). This causes some changes on lines that weren't changed but it follows the convention that celfmt sets.

Enhanced error handling in the CEL program to prevent 'no such key: product_batch_size' errors by ensuring proper propagation of the state data configuration during failures. This was accomplished by wrapping the objects returned from errors with state.with()
@StacieClark-Elastic
StacieClark-Elastic force-pushed the bugfix/m365-defender-failed-request-recovery branch from e52a839 to a46530c Compare July 29, 2025 18:16
Comment thread packages/m365_defender/data_stream/vulnerability/agent/stream/cel.yml.hbs Outdated
…am with state.with()

instead of wrapping each error event with state.with()
@elasticmachine

Copy link
Copy Markdown

💚 Build Succeeded

History

@StacieClark-Elastic
StacieClark-Elastic merged commit 18748f2 into elastic:main Jul 30, 2025
9 checks passed
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package m365_defender - 3.14.0 containing this change is available at https://epr.elastic.co/package/m365_defender/3.14.0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes a bug issue Integration:m365_defender Microsoft Defender XDR Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

5 participants