noqt commited on
Commit
cd3654b
·
1 Parent(s): 1ee3fb8

fix: keep incident queries within protocol bound

Browse files
src/lumi_eggcracker/incidents.py CHANGED
@@ -428,15 +428,14 @@ def link(root: Path, value: dict[str, Any], receipt: dict[str, Any], *, partial:
428
 
429
  def summary(value: dict[str, Any]) -> dict[str, Any]:
430
  checked = validate(value)
 
 
 
 
431
  return {
432
  "incident_id": checked["incident_id"],
433
  "state": checked["state"],
434
  "trigger": checked["trigger"],
435
- "created_monotonic_ns": checked["created_monotonic_ns"],
436
- "generation": checked["generation"],
437
- "relaunch_suppressed": checked["response"]["relaunch_suppressed"],
438
- "response_completed": checked["response"]["completed"],
439
- "recurrence_contained": checked["recurrence"]["contained_matches"],
440
  }
441
 
442
 
 
428
 
429
  def summary(value: dict[str, Any]) -> dict[str, Any]:
430
  checked = validate(value)
431
+ # Query/operator sockets receive only the identities needed to correlate
432
+ # and clear a bounded incident. Full detector, approval and workload
433
+ # detail stays behind the root-admin ``incident show`` action so a busy
434
+ # campaign cannot make the authenticated response frame unavailable.
435
  return {
436
  "incident_id": checked["incident_id"],
437
  "state": checked["state"],
438
  "trigger": checked["trigger"],
 
 
 
 
 
439
  }
440
 
441
 
tests/test_incidents.py CHANGED
@@ -162,6 +162,37 @@ class IncidentTests(unittest.TestCase):
162
  incidents.MAX_INCIDENTS,
163
  )
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
  if __name__ == "__main__":
167
  unittest.main()
 
162
  incidents.MAX_INCIDENTS,
163
  )
164
 
165
+ def test_summary_is_bounded_query_identity(self) -> None:
166
+ with tempfile.TemporaryDirectory() as raw:
167
+ root = Path(raw)
168
+ value = incidents.create(
169
+ root,
170
+ receipt=_receipt(),
171
+ policy={"version": "1.0.0"},
172
+ catalogue_sha256="e" * 64,
173
+ source_commit="f" * 40,
174
+ version="1.0.0",
175
+ trigger="UNAPPROVED_AI_MATCH",
176
+ profile="content.gguf-llama",
177
+ evidence=["gguf-v3"],
178
+ match={
179
+ "argv_sha256": "b" * 64,
180
+ "executable_sha256": "c" * 64,
181
+ "profile": "content.gguf-llama",
182
+ "uid": 2001,
183
+ },
184
+ workload=_receipt()["workload"],
185
+ approval=None,
186
+ )
187
+ self.assertEqual(
188
+ incidents.summary(value),
189
+ {
190
+ "incident_id": "a" * 24,
191
+ "state": "ACTIVE",
192
+ "trigger": "UNAPPROVED_AI_MATCH",
193
+ },
194
+ )
195
+
196
 
197
  if __name__ == "__main__":
198
  unittest.main()