Repository navigation
feat(cli): add detections command for triage - #139
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
|
Thank you for this, and for the three install bugs you filed on the way to it. Finding that the project does not install on a clean Windows machine was far more valuable than the issue you were assigned, and all three are fixed and released in #141. That is the kind of contribution nobody on the inside can make, because we all have working machines. The CLA check was red on a stale run from before you signed. I have re-run it and this is now green. The implementation follows One thing before I mergeThe endpoint returns Which is not true. It means nothing was ever recorded for any session, and someone reading that would go looking for a session that was never captured rather than turning export on. Something like: if not data.get("enabled", True):
print("Audit export is disabled, so no sessions are recorded.")
print("Set AGENTMETRY_AUDIT_EXPORT=1 and restart.")
return 1
That is the only change. Push it and I will merge. If you want moreYou clearly have a good eye for the parts that break for a first-time user, which is the part this project is weakest on and the hardest thing to see from the inside. #100 is the natural next one if you want it, though @kkkhs has a PR open for it, so #36 or #25 on benchmark corpus coverage may be better. Or anything you trip over while using it, which so far has been the richest seam. And if you know anyone who would enjoy taking a detection tool apart, send them. The most useful thing anyone sends this project is a report that a rule fired on something legitimate, and there is a standing offer: a case that makes a rule misfire is worth more here than a case that confirms it works. |
Incident triage currently requires calling the audit endpoint directly. Expose ranked findings by correlation ID, with clean output for empty sessions and an unavailable orchestrator. Closes blitzcrieg1#8
b7faf58 to
9e7c379
Compare
|
I have reproduced the exact problem actually. Now, I'm fixing this. |
An empty detections list can mean export is disabled, not that the session has no findings. Report the disabled state and return a non-zero exit code so operators know recording must be enabled.
Summary
Adds
agentmetry detections <correlation_id>so a session's correlateddetections can be inspected without calling the audit API manually.
GET /api/v1/audit/detections/{correlation_id}Why
The detections endpoint already supports session-level incident triage, but
CLI users currently need to construct the HTTP request themselves. This adds
the one-line workflow described in the issue while keeping ranking logic in
the detection API.
Testing
python -m ruff check agentmetry tests toolspython -m pytest -q— 1154 passed, 1 skippedNo detections1Scope
This is limited to the CLI command and its focused tests. It does not change
the detections API, detection rules, event schema, or dashboard.
Closes #8