Skip to content

fix(session): add asyncio.Lock to guard concurrent state mutations (AUTH-002) - #217

Merged
imran-siddique merged 1 commit into
mainfrom
fix/security-medium-session-lock
Jun 6, 2026
Merged

fix(session): add asyncio.Lock to guard concurrent state mutations (AUTH-002)#217
imran-siddique merged 1 commit into
mainfrom
fix/security-medium-session-lock

Conversation

@imran-siddique

Copy link
Copy Markdown
Member

Summary

Test plan

  • test_session_state_has_mutation_lock — SessionState exposes an asyncio.Lock
  • test_concurrent_update_and_reset_do_not_corrupt_state — 10 interleaved update/reset tasks produce valid state
  • Full suite: 373 tests pass locally

🤖 Generated with Claude Code

…UTH-002)

Concurrent tool-call coroutines and session-reset requests could
interleave after an await boundary, corrupting max_sensitivity or
losing injection events. Added `mutation_lock: asyncio.Lock` to
SessionState and wrapped update_from_inspection() in proxy.py and
reset() in server.py with `async with self._session.mutation_lock`.

Closes #164

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imran-siddique
imran-siddique merged commit 0f7024d into main Jun 6, 2026
0 of 7 checks passed
@imran-siddique
imran-siddique deleted the fix/security-medium-session-lock branch July 29, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant