Re-check the disabled workspace after consuming the invitation in register/complete
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 54/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- authentication, backend, databases
Research direction
Start with server/orcaster_server/auth/router.py, reading accept_register_complete around lines 386–417 and comparing the post-consume check in the join endpoint around lines 283–284. Then find the registration tests that cover normal completion and early refusal, and add the two-call refusal case from the acceptance criteria. Done means it returns 410 with reason refused, leaves no user, credential, membership, or consumed invitation, and adds a CHANGELOG entry; the workspace locking question needs an owner decision.
Written by the indexing model from the issue text.
Description
Problem
In POST /auth/accept/{token}/register/complete, the host refusal check (for example a disabled workspace) runs before the user is created (server/orcaster_server/auth/router.py:386). The invitation is consumed later (server/orcaster_server/auth/router.py:400) and the transaction is committed after the callback (server/orcaster_server/auth/router.py:417). There is no second check after the consume.
If the workspace is disabled between the first check and the commit, the registration still succeeds and the callback adds a membership to a disabled workspace. The join endpoint already checks after the consume and rolls back on refusal (server/orcaster_server/auth/router.py:283 and server/orcaster_server/auth/router.py:284).
Proposed change
- In
accept_register_complete, afterconsume_invitationreturns OK, call_refused(db, inv)again. - If it is refused, return the same 410 response with
reasonrefusedas the early check. Nothing is committed, so the user, credential and consume are rolled back, as for the other early returns. - Keep the early check, so a refused invitation still creates no rows.
Acceptance criteria
- A test makes
is_invitation_refusedreturn false on the first call and true on the second, and shows thatregister/completeanswers 410 withreasonrefused, creates no user, no credential and no membership, and leaves the invitation unconsumed. - The normal registration and the existing early refusal keep their responses.
- The response codes and
reasonvalues of the endpoint do not change, so existing deployments and clients keep working without changes. - CHANGELOG entry under Unreleased.
Open questions
- Should the check also lock the workspace row, so that a disable cannot commit between the re-check and the commit? The re-check narrows the window but a row lock would close it. This needs an owner decision, since it adds locking to the registration path.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AInvirion/orcaster
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
enhancement good first issue P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
All issues in AInvirion/orcaster
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
daniel-ospina/tortoise#15308 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
difficulty:easy prio:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NatronGitHub/Natron#2405 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Jstar269/nakagawa-recomp#3746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day