fix(db): add missing tenant_id filter in queries (#10722)

This commit is contained in:
Pepe Fagoaga
2026-04-16 11:55:38 +02:00
committed by GitHub
parent 4002c28b5d
commit 12bf3d5e70
2 changed files with 11 additions and 1 deletions
@@ -248,7 +248,9 @@ def _fetch_findings_batch(
with rls_transaction(tenant_id, using=READ_REPLICA_ALIAS):
# Use `all_objects` to get `Findings` even on soft-deleted `Providers`
# But even the provider is already validated as active in this context
qs = FindingModel.all_objects.filter(scan_id=scan_id).order_by("id")
qs = FindingModel.all_objects.filter(
tenant_id=tenant_id, scan_id=scan_id
).order_by("id")
if after_id is not None:
qs = qs.filter(id__gt=after_id)