CVE-2026-104970: Python Django Toctou Existence Guard Then Create Without Atomic Lock

TOCTOU race in $FUNC: a $MODEL row is guarded only by a plain, non-atomic existence read ($MODEL.objects.first()/exists()), but the corresponding $MODEL.objects.create() runs outside any transaction.atomic() block and without a select_for_update() row lock. Two concurrent requests can both pass the guard and both create the row, breaking the at-most-one inva

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Python
greprules fetch cve-2026-104970-python-django-toctou-existence-guard-then-create-without-atomic-lock --engine opengrep

Description

TOCTOU race in $FUNC: a $MODEL row is guarded only by a plain, non-atomic existence read ($MODEL.objects.first()/exists()), but the corresponding $MODEL.objects.create() runs outside any transaction.atomic() block and without a select_for_update() row lock. Two concurrent requests can both pass the guard and both create the row, breaking the at-most-one inva