fix(sentinelone): fail a UAM update the console did not apply (1.17.2)
The assignee mutation came back with the alert under success while the console kept its previous assignee, and the playbook block passed. The script now reads the alert back and fails, naming the assignee the console holds, when it is not the requested user. The status, verdict and assignee updates also fail when the alert is listed under failure or skip: the console answers those with a 200 and no errors array. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013u8PFdkYuuPiC6JdZBV5x3
This commit is contained in:
@@ -35,6 +35,15 @@ def main():
|
||||
if resp.get("errors"):
|
||||
print(json.dumps({"error": "GraphQL error", "detail": resp["errors"]}))
|
||||
sys.exit(1)
|
||||
# A refused or skipped alert comes back in the payload, not in errors: the
|
||||
# console answers 200, and printed as-is it would read as a done update.
|
||||
triggered = ((resp.get("data") or {}).get("alertTriggerActions") or {}).get("actions") or []
|
||||
failures = [f for a in triggered for f in (a.get("failure") or [])]
|
||||
skipped = [s for a in triggered for s in (a.get("skip") or [])]
|
||||
if failures or skipped or not any(a.get("success") for a in triggered):
|
||||
print(json.dumps({"error": "The console did not update the alert",
|
||||
"failure": failures, "skip": skipped, "result": resp.get("data")}))
|
||||
sys.exit(1)
|
||||
print(json.dumps(resp))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user