[PR #392] fix: use transactions when operations involve multiple database queries #845

Closed
opened 2025-10-08 00:18:17 +03:00 by OVERLORD · 0 comments
Owner

Original Pull Request: https://github.com/pocket-id/pocket-id/pull/392

State: closed
Merged: Yes


Currently, the backend does not use database transactions, even when there are operations performed in sequence. For example: 4d049bbe24/backend/internal/service/user_service.go (L166-L194) where the user is loaded from the DB and then updates

This can cause a number of problems if multiple requests happen in parallel, and in some cases could also have security implications.

This PR updates the backend's to add transactions where they are needed.

**Original Pull Request:** https://github.com/pocket-id/pocket-id/pull/392 **State:** closed **Merged:** Yes --- Currently, the backend does not use database transactions, even when there are operations performed in sequence. For example: https://github.dev/pocket-id/pocket-id/blob/4d049bbe24aa0b714c6f97369f1562064076a3b4/backend/internal/service/user_service.go#L166-L194 where the user is loaded from the DB and then updates This can cause a number of problems if multiple requests happen in parallel, and in some cases _could_ also have security implications. This PR updates the backend's to add transactions where they are needed.
OVERLORD added the pull-request label 2025-10-08 00:18:17 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id-pocket-id-1#845