You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding a user, an organization with their name is stored. If an organization with the same name already exists (e.g. when one of the repos of the user-to-be has already been added to woodpecker) this operation fails.
The problematic code does not check if the organization already exists, it attempts to store the organization, which results in a unique constraint violation on the orgs table, which the user gets to see.
Steps to reproduce
Install and configure fogejo, with an admin user and an additional user
Create a repo in the main user's account and in the additional user's account
Install woodpecker and configure the integration with forgejo
Enable the secondary user's repo in woodpeckers ui
Attempt now to add the additional user as a woodpecker user
Expected behavior
The user can be added to woodpecker without problems
### Additional context
_No response_
### Validations
- [X] Read the [docs](https://woodpecker-ci.org/docs/intro).
- [X] Check that there isn't [already an issue](https://github.com/woodpecker-ci/woodpecker/issues) that reports the same bug to avoid creating a duplicate.
- [X] Checked that the bug isn't fixed in the `next` version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
The text was updated successfully, but these errors were encountered:
e.g. when one of the repos of the user-to-be has already been added to woodpecker
You mean when an instance admin or another user with repo access enabled he repo before the actual owning user has been registered as a user? Yes, that makes sense. This is indeed a bug then.
If there is a full match for a user and an existing org, I think we should just grant full permissions on the org.
Right now I can't think of an edge case where this would not be the right task. Also in terms of security this should not be exploitable as users/namespaces cannot easily be taken over?
I'm having the same issue after trying to setup Woodpecker with Gitea. I added a repo that the user-to-be owns, he tried to login afterwards to Woodpecker and got the same exact error. Deleting all repos by him on Woodpecker does not fix this problem.
You mean when an instance admin or another user with repo access enabled he repo before the actual owning user has been registered as a user? Yes, that makes sense. This is indeed a bug then.
@pat-s yes, that is correct. In my opinion, as long as the order of these two events (adding repos and adding users) is not somewhat enforced, I would say this is a bug.
Also it seems this error is non-recoverable, as also reported by @TibixDev (in my case I threw away the DB and started anew).
Component
server
Describe the bug
When adding a user, an organization with their name is stored. If an organization with the same name already exists (e.g. when one of the repos of the user-to-be has already been added to woodpecker) this operation fails.
The problematic code does not check if the organization already exists, it attempts to store the organization, which results in a unique constraint violation on the
orgs
table, which the user gets to see.Steps to reproduce
Expected behavior
The user can be added to woodpecker without problems
System Info
The text was updated successfully, but these errors were encountered: