Skip to content

Commit 6bdd50e

Browse files
fix: avoid leaking batch existence on user mismatch (Copilot review)
1 parent e481341 commit 6bdd50e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/backend/common/database/cosmosdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ async def create_batch(self, user_id: str, batch_id: UUID) -> BatchRecord:
9595
item=str(batch_id), partition_key=str(batch_id)
9696
)
9797
if batchexists.get("user_id") != user_id:
98-
self.logger.error("Batch belongs to a different user", batch_id=str(batch_id), existing_user=batchexists.get("user_id"), requesting_user=user_id)
99-
raise ValueError("Batch belongs to a different user")
98+
self.logger.error("Batch belongs to a different user", batch_id=str(batch_id))
99+
raise CosmosResourceNotFoundError(message="Batch not found")
100100
self.logger.info("Returning existing batch record", batch_id=str(batch_id))
101101
return BatchRecord.fromdb(batchexists)
102102
except CosmosResourceNotFoundError:

0 commit comments

Comments
 (0)