feat(microsoft-defender-o365): mvp1/chk2 - define business configuration (pydantic base settings) (#493) - #494
Conversation
4a386b6 to
1d831ac
Compare
…branch (#471) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… branch (#493) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…k2 config (#493) - 1 HAPPY PATH feature: valid_configuration_loads (tests/features/) - 3 UNHAPPY PATH features: missing_required_field, numeric_field_below_minimum, cross_field_auth_mode_consistency (tests/constraints/) - PR #494 body provided a generic Gherkin template with placeholders; resolved them against the DefenderO365Config contract and Done Checklist (confirmed with user before writing) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ee1400d to
cb5580c
Compare
…ses (#493) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…onftest comment (#493) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…493) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…#493) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mariot
left a comment
There was a problem hiding this comment.
Just a small request about the secret string
| "source_use_certificate_auth": { | ||
| "data": self.source.use_certificate_auth | ||
| }, | ||
| "source_client_secret": {"data": self.source.client_secret}, |
There was a problem hiding this comment.
this passes a SecretStr object into daemon config, not the actual string secret. Downstream code typically expects a plain string (other collectors call .get_secret_value())
source_client_secret should likely unwrap SecretStr before forwarding (self.source.client_secret.get_secret_value() when set). Passing the SecretStr object directly can break downstream auth config handling
There was a problem hiding this comment.
Good point @mariot .
However, this is intentional. I'd prefer to keep the value as a SecretStr for as long as possible and only call get_secret_value() at the point where the secret is actually consumed. Unwrapping it during configuration serialization defeats much of the purpose of using SecretStr, since it turns the secret into a plain string earlier than necessary.
Parent Issue: #493
Parent PR (MVP): #492
Contracts
Input Contract
None, this is a leaf configuration model with no upstream data dependency.
Output Contract
Consumed by: CHK.3 (ConfigLoader wiring), CHK.4 (auth), CHK.6 (fetcher).
Acceptance Criteria
Done Checklist
src/models/settings/source_configs.pywithDefenderO365Config(ConfigBaseSettings)Field(...)descriptions, and defaults@field_validatorfortenant_id(non-empty) andrate_limit_requests_per_minute(>= 1)@model_validatorfor auth mode consistencyREADME.mdwithMICROSOFT_DEFENDER_O365_*env variable tableCloses #493