Spaces:
Running
Running
fix: keep incident queries within protocol bound
Browse filesFiles changed (2)
427 unmodified lines428429430431432433434435436437438439440441442427 unmodified linesdef summary(value: dict[str, Any]) -> dict[str, Any]:checked = validate(value)return {"incident_id": checked["incident_id"],"state": checked["state"],"trigger": checked["trigger"],"created_monotonic_ns": checked["created_monotonic_ns"],"generation": checked["generation"],"relaunch_suppressed": checked["response"]["relaunch_suppressed"],"response_completed": checked["response"]["completed"],"recurrence_contained": checked["recurrence"]["contained_matches"],}427 unmodified lines428429430431432433434435436437438439440441427 unmodified linesdef summary(value: dict[str, Any]) -> dict[str, Any]:checked = validate(value)# Query/operator sockets receive only the identities needed to correlate# and clear a bounded incident. Full detector, approval and workload# detail stays behind the root-admin ``incident show`` action so a busy# campaign cannot make the authenticated response frame unavailable.return {"incident_id": checked["incident_id"],"state": checked["state"],"trigger": checked["trigger"],}
161 unmodified lines162163164165166167161 unmodified linesincidents.MAX_INCIDENTS,)if __name__ == "__main__":unittest.main()161 unmodified lines162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198161 unmodified linesincidents.MAX_INCIDENTS,)def test_summary_is_bounded_query_identity(self) -> None:with tempfile.TemporaryDirectory() as raw:root = Path(raw)value = incidents.create(root,receipt=_receipt(),policy={"version": "1.0.0"},catalogue_sha256="e" * 64,source_commit="f" * 40,version="1.0.0",trigger="UNAPPROVED_AI_MATCH",profile="content.gguf-llama",evidence=["gguf-v3"],match={"argv_sha256": "b" * 64,"executable_sha256": "c" * 64,"profile": "content.gguf-llama","uid": 2001,},workload=_receipt()["workload"],approval=None,)self.assertEqual(incidents.summary(value),{"incident_id": "a" * 24,"state": "ACTIVE","trigger": "UNAPPROVED_AI_MATCH",},)if __name__ == "__main__":unittest.main()
src/lumi_eggcracker/incidents.py+4-5
tests/test_incidents.py+31