Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted user is being used in branch protection whitelisting #19094

Closed
plsnp opened this issue Mar 15, 2022 · 2 comments · Fixed by #19158
Closed

Deleted user is being used in branch protection whitelisting #19094

plsnp opened this issue Mar 15, 2022 · 2 comments · Fixed by #19158
Assignees
Labels
Milestone

Comments

@plsnp
Copy link
Contributor

plsnp commented Mar 15, 2022

Gitea Version

1.14.6 built with go1.16.7

Git Version

2.34.1

Operating System

SUSE Linux Enterprise Server 15 SP3

How are you running Gitea?

sudo zypper addrepo https://download.opensuse.org/repositories/devel:tools:scm/openSUSE_Leap_15.3/devel:tools:scm.repo
sudo zypper refresh
sudo zypper install gitea
sudo systemctl enable gitea --now

Database

SQLite

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://bpa.st/UZYA

Description

  1. some users were created
  2. some branches were protected, but some users whitelisted (user 1 and 2)
  3. ldap was activated, but conflicted with existing user. user 1 was deleted through GUI (later re-added over ldap as user 13)
  4. whitelist shows only user 2
  5. trying to add user 3 to whitelist
  6. 500 internal server error.
  7. LOG: 2022/03/15 14:49:15 ..._protected_branch.go:266:SettingsProtectedBranchPost() [E] UpdateProtectBranch: GetUserByID [user_id: 1, repo_id: 3]: user does not exist [uid: 1, name: , keyid: 0]
  8. in html it shows that user 1 and 2 were send to html in value field
  9. downloaded gitea sqlite database, table protected_branch, column whitelist_user_i_ds shows user 1 active on some branches

Possible cause: when deleted user, user is not removed from whitelisted branches

I searched for bug but couldn't find. Sorry if this has already been fixed in the meanwhile, i can't try the latest version at the moment.

Screenshots

No response

@lunny lunny added the type/bug label Mar 16, 2022
@lunny
Copy link
Member

lunny commented Mar 16, 2022

Could you upgrade to v1.16.4 and try it again?

@noerw
Copy link
Member

noerw commented Mar 21, 2022

Can confirm with 1.17.0+dev-309-gb05b40180

@noerw noerw self-assigned this Mar 21, 2022
noerw added a commit to noerw/gitea that referenced this issue Mar 21, 2022
lunny pushed a commit that referenced this issue Mar 22, 2022
* Clean up protected_branches when deleting user

fixes #19094

* Clean up protected_branches when deleting teams

* fix issue

Co-authored-by: Lauris BH <[email protected]>
noerw added a commit to noerw/gitea that referenced this issue Mar 22, 2022
* Clean up protected_branches when deleting user

fixes go-gitea#19094

* Clean up protected_branches when deleting teams

* fix issue

Co-authored-by: Lauris BH <[email protected]>
lunny added a commit that referenced this issue Mar 23, 2022
* Clean up protected_branches when deleting user

fixes #19094

* Clean up protected_branches when deleting teams

* fix issue

Co-authored-by: Lauris BH <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
@zeripath zeripath modified the milestones: 1.17.0, 1.16.5 Mar 23, 2022
Chianina pushed a commit to Chianina/gitea that referenced this issue Mar 28, 2022
* Clean up protected_branches when deleting user

fixes go-gitea#19094

* Clean up protected_branches when deleting teams

* fix issue

Co-authored-by: Lauris BH <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants