Trace the call path
A route can delegate a mutation three files away. The call graph keeps the connection intact.
Find read-modify-write races, reproduce them under pressure, and patch them without touching your formatting.
Both requests read the same balance.
cguard follows the read, the check, and the write — even when they are separated by application code.
01def deduct(user_id, amount):02 wallet = Wallet.objects.get(id=user_id)03 if wallet.balance < amount:04 raise InsufficientFunds()05 wallet.balance -= amount06 wallet.save()
Every stage leaves evidence you can inspect locally.
A route can delegate a mutation three files away. The call graph keeps the connection intact.
Taint tracking follows a mutable reference through aliases, arguments, and attribute access.
The runtime verifier releases workers at a barrier, then compares the observed state with the invariant.
LibCST makes a narrow source edit and preserves the comments and layout already in your file.
# keep this audit noteEvery displayed number has a source. Modeled timeline outcomes are labeled as simulations.
Sixteen documented checks across ORM, runtime, file, cache, and lock behavior.
| Rule | Framework | Pattern | Auto-fix |
|---|---|---|---|
| CG-001 | SQLAlchemy / FastAPI | Unlocked read-modify-write | Yes |
| CG-002 | FastAPI | Missing idempotency header | Yes |
| CG-003 | asyncio / SQLAlchemy | Query inside async loop | No |
| CG-004 | SQLAlchemy | Check-then-act uniqueness | Yes |
| CG-005 | Celery | Non-idempotent retry | No |
| CG-006 | asyncio | Shared-state mutation | Yes |
| CG-007 | threading | Threaded collection mutation | Yes |
| CG-008 | Python | Generic read-modify-write | No |
| CG-009 | Filesystem | Concurrent file write | Yes |
| CG-010 | Filesystem | Shared tempfile | No |
| CG-011 | Redis / cache | Cache check-then-act | No |
| CG-012 | Cache | Non-atomic invalidation | No |
| CG-013 | Locks | Lock-order inversion | No |
| CG-014 | Python | Cross-file call-chain race | No |
| CG-015 | Python | Tainted shared-state mutation | No |
| CG-016 | Django | Unlocked ORM mutation | Yes |
Install the CLI, scan a path, and review the source-preserving patch on your own machine.
PRIVACY / Nothing leaves your machine. cguard parses source with Python AST and LibCST locally.
Early access for a GitHub App that turns a detected race into a reviewable patch.