api: use Domain.select_for_update() to prevent races

Open
#1,292 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 14 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
api, database

Research direction

Start from commit 1c25419e7e0ed4a0be0fd6b50bdcd7997177632f, which the issue names as the source of the race, and find the code path where a Domain is read and then modified without a row lock. The fix is to lock the Domain row with select_for_update() inside a transaction at that point. Done when the racy path takes the lock and the existing API tests still pass.

Written by the indexing model from the issue text.

Description

api bug

for fixing 1c25419e7e0ed4a0be0fd6b50bdcd7997177632f at the root

Dominant language
Python
Stars
678
Forks
74
Avg merge
7d 23h
Merged PRs (30d)
1

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from desec-io/desec-stack

All issues in desec-io/desec-stack

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.