AAK-AGENT-HARNESS-SHARED-STATE-001: Multi-agent shared state mutated by two or more agents without a lock primitive (Code-as-Harness, research-grade)
- Severity
- MEDIUM
- Category
- A2A Protocol (
a2a-protocol) - Scanner
agent_audit_kit/scanners/agent_harness_shared_state.py- Auto-fixable
- No.
- SARIF name
MultiAgentSharedStateNoLock
What it detects
A module-level mutable object (dict / list / set / comprehension result) is mutated by methods of >=2 distinct Agent / Worker / Harness classes without a lock primitive (threading.Lock / asyncio.Lock / etc.) visible in any of the mutating function bodies. Per Code as Agent Harness (Ning et al., arXiv:2605.18747, 2026-05-18 — survey of 110+ papers + 23 systems), 'consistent shared state across multiple agents' is named as an explicit open challenge. Research-grade — MEDIUM reflects expected false-positive rate when serialization is enforced by an external coordinator (database transaction, message queue) the AST scanner can't see.
How to fix
Guard every mutation against the shared symbol with a lock primitive (threading.Lock / asyncio.Lock / multiprocessing.Lock). If serialization is enforced by an external coordinator (database transaction, message queue), list the file under ignore-paths in .agent-audit-kit.yml; AAK reads no per-line suppression comment.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-AGENT-HARNESS-SHARED-STATE-001
Limitations
Tracks only module-level dict, list and set objects that methods of classes whose names end in Agent, Worker or Harness mutate. The same shared state held as a class attribute (self.registry[key] = value), or mutated by classes named Researcher and Writer, is not seen. A method that mentions a name such as Lock or acquire counts as locking, so with threading.Lock():, which makes a new lock on every call and excludes nothing, clears it. A Python file over 512 KB is not read.
References
- OWASP Agentic Top 10: ASI06 (Memory & Context Poisoning), ASI08 (Cascading Failures)
- Incidents and advisories: ARXIV-2605.18747
- CSA AI Controls Matrix (AICM): AIS-04, IAM-05
All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-AGENT-HARNESS-SHARED-STATE-001.md: the page then shows that text, with the registry reference appended under it.