All security_monitoring_rules fail to sync: cases.condition is stripped from the create payload
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Inizia da datadog_sync/model/security_monitoring_rules.py, in particolare alle righe 26–46 e 114–123. Traccia come viene usato excluded_attributes sia per il diffing sia per i payload di create/update, e controlla il parsing della risposta 400 rispetto al body documentato {"error": {...}}. Il lavoro è completato quando cases.condition viene mantenuto nei payload, il messaggio di validazione di Datadog viene conservato e vengono soppressi solo i diff di condition previsti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Syncing security_monitoring_rules fails to create every non-default rule that has case conditions. There are two compounding bugs:
- Masking bug: the 400-handling code does error_obj["errors"], but the API error body uses a different shape, so it raises KeyError: 'errors'. That KeyError replaces the real Datadog message, and the log only shows a useless message.
Example output:
2026-06-25 16:33:22,449 - ERROR - [security_monitoring_rules - xxx-xxx-xxx] - 'errors'
The body is {"error": {...}}, not the {"errors": [...]} the code assumes. Once I fixed this bug locally, I found the real bug
2026-06-25 16:59:31,955 - ERROR - [security_monitoring_rules - xxx-xxx-xxx] - 400 Bad Request - {"error":{"code":"InvalidArgument","message":"Invalid rule configuration","details":[{"code":"InvalidArgument","message":"Query a must be used at least once in a case","target":"cases"},{"code":"InvalidArgument","message":"Case condition cannot be empty","target":"cases[0].condition"}]}}
- Root cause: "cases.condition" is listed in excluded_attributes. Excluded attributes doesn't only affect diffing, but also it is stripped from the create/update payload too. Since condition is required by the rule API, every create is rejected with HTTP 400.
I can bypass this second bug by removing the cases.condition from the excluded attributes, which allows me to create the resources at the new account
Note: simply removing cases.condition from excluded_attributes fixes creation but may reintroduce the spurious diffs that #311 was trying to suppress (the API computes condition for some rule types, e.g. anomaly). The two concerns should be decoupled: keep condition in the payload, but ignore it in the diff via DeepDiff exclude_regex_paths (exclude_paths as used by excluded_attributes doesn't match list indices like root['cases'][0]['condition']).
- Lingua principale
- Python
- Stelle
- 79
- Fork
- 26
- Merge medio
- 22h 1m
- PR unite (30g)
- 25
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DataDog/datadog-sync-cli
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
DataDog/datadog-sync-cli#698 · 1 reazione ·
-
CCM Resources Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
DataDog/datadog-sync-cli#697 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
DataDog/datadog-sync-cli#597 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
DataDog/datadog-sync-cli#501 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
DataDog/datadog-sync-cli#353 ·
Tutte le issue di DataDog/datadog-sync-cli
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
stephrobert/dsoxlab#238 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sublimehq/package_control#1780 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nwg-piotr/nwg-displays#145 ·