gitea: Unable to create repository as owner for a specific organisation
Description
Post upgrading a server to 1.17.0 (from 1.16.8) the ability to create repositories for one specific organisation became forbidden for owners.
a gitea dump was performed from the windows machine and reproduced on a linux machine. More so the entire gitea instance was stripped right back to a minimal reproducible instance.
console log:
2022/08/02 22:29:00 [62e9971c] router: completed GET /IPCCA for [::1]:47414, 200 OK in 155.7ms @ user/profile.go:29(user.Profile)
2022/08/02 22:29:01 [62e9971c-2] router: completed GET /user/events for [::1]:47414, 200 OK in 1213.8ms @ events/events.go:19(events.Events)
2022/08/02 22:29:01 [62e9971d] router: completed GET /repo/create?org=22 for [::1]:47426, 403 Forbidden in 2.4ms @ repo/repo.go:132(repo.Create)
url attempting to access: http://localhost:3000/repo/create?org=2 gitea-dump-1659476345.zip
username: j password: qwertyuiop
admin: administrator password: qwertyuiop
Gitea Version
1.17.0
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.35.1
Operating System
windows ( and linux)
How are you running Gitea?
windows service or from a sh
Database
MySQL
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 29 (21 by maintainers)
I’m having this issue on the latest Gitea release.
I have a gitea instance with two users (an ‘admin’ user that I use rarely, and another user that I normally use) and one organisation (‘mirrors’, which I use for mirroring external repos). Since approximately August, if I create a migration under the ‘mirrors’ organisation, it fails immediately with “Forbidden”. If I create a migration under my normal account, it works, and I can then transfer the repository to the ‘mirrors’ organisation. Clicking the update button in the settings of the organisation did not help resolve this issue.
Edit: Correction, going to the organisation settings, clicking ‘teams’, clicking the title of the ‘owners’ team and then clicking update did in fact fix the issue.
1.17.1 doesn’t automatically fix orgs affected
You need to goto the “owner” team’s settings and press “update settings” (no need to change anything)
Whether there is a way todo this to all orgs (especially large instances) is a different questipn
hi, just check and it is.
For clarification Site admin can create new repos for this org Org owners for this org cannot make repos Other org owners can make repos in their org Making a new team in this org with admin rights permits repos to be made
Also hit this bug, I worked around via SQL:
Maybe we should add a migration with that? As I understand it, every “Owners” team should have this permission as it’s not configurable on the UI.
I don’t think this issue is fixed… For me after upgrading from 1.16.x to 1.17.1 had still issues with lot of owner teams
So to further isolate the problem, I did these steps:
can_create_org_repo
in databasecan_create_org_repo
has been reset tofalse
From what I see in the logs:
This is probably the code in https://github.com/go-gitea/gitea/blob/d81e31ad7826a81fc7139f329f250594610a274b/models/organization/org_user.go#L76-L84
When executing this query manually, I get an empty result, obviously because the
can_create_org_repo
column isfalse
:This is the case for many Owners groups, though not all:
Should this flag be true on the Owners groups or is this irrelevant due to some hard coded permission elsewhere for this group? If it is relevant, do we know, why it gets lost?
Once you updated 1.17.1, edit the team information then this team’s permission should be recovered.