gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Proposal: fork count limit

Open SagePtr opened this issue 7 years ago • 16 comments

  • Gitea version (or commit ref): ced08d1
  • Git version: 2.15.1
  • Operating system: Linux
  • Database (use [x]):
    • [ ] PostgreSQL
    • [x] MySQL
    • [ ] MSSQL
    • [ ] SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • [ ] Yes (provide example URL)
    • [ ] No
    • [x] Not relevant (server is down)
  • Log gist:

Description

How to reproduce:

  1. Create new user.
  2. Set repository limit to 0 for this user.
  3. Try to create new repo (limit reached, repo won't be created).
  4. Try to fork existing repo - repo will be forked successfully, resulting user having more repos than he is limited to.

SagePtr avatar Aug 01 '18 09:08 SagePtr

We have two choices, one is add another option fork repository limit, another is to limit fork when the value is 0.

lunny avatar Aug 01 '18 10:08 lunny

Forking not counting in limit is intended behaviour so that users could still submit PRs even if they can not create own repositories

lafriks avatar Aug 01 '18 10:08 lafriks

Then probably forks should count separately from num_repos and max_repo_creation. With unlimited fork feature, repo limit has no sense because user can fork any repo, clean fork's content and use it as he wants.

SagePtr avatar Aug 01 '18 10:08 SagePtr

@SagePtr maybe you can change the title.

lunny avatar Aug 02 '18 03:08 lunny

Perhaps a third option, a boolean to toggle whether it counts towards limit or not?
This way, admins can decide whether it makes sense for their situation.

While a public instance may worry about forking as a means of bypassing limit, self-hosted private admins may want forks for PRs.

EDIT: I suppose even with a number, a -1 would be the same as just swapping a toggle. Probably the better choice.

jolheiser avatar Jul 17 '19 15:07 jolheiser

Or a repository could have an option to enable or disable fork. Fork limitation is non-meaningful.

lunny avatar Jul 18 '19 01:07 lunny

Or a repository could have an option to enable or disable fork. Fork limitation is non-meaningful.

this is a much better idea. forking is is designed to be related to its original repository and we must stick to that perspective and not on the point someone cannot create a fork.

1902sysad avatar Jul 18 '19 07:07 1902sysad

This is a major issue for me. I need users to be able to post issues but I don't have the space to afford repo creation nor repo creation by forking. Otherwise I need to shut user registrations down completely.

From this perspective i was surprised that MAX_CREATION_LIMIT didn't target this. Will be happy with a similar MAX_FORKING_LIMIT setting.

sefsh avatar May 21 '20 11:05 sefsh

New Migration has the same problem.

oicu avatar May 24 '20 13:05 oicu

Bumping. This issue still exists and doesn't seem to have been addressed anywhere.

InfernalPlank avatar May 18 '22 17:05 InfernalPlank

I've hit this as well. A workaround seems to be to change the permissions in the Gitea root repository folder to deny the Gitea user write access, so Gitea cannot create folders for any new users' repos/forks.

This could be combined (e.g. as suggested in #8831) with custom CSS to hide the “fork” button on the client side.

I note that setting the repo creation limit to 0 is currently recommended in the FAQ to have an “issue only user”. But if forks cannot be limited then this does not create true “issue only” access.

RunasSudo avatar Aug 23 '22 08:08 RunasSudo

+1, we've seen users use this to bypass the MAX_CREATION_LIMIT. they just fork anything, then clear it out and start adding the material they want to push to our server (hint, it's usually not what we want to be hosting). We would really appreciate a proper way to limit this behaviour as we still would like to allow user sign up for reporting issues on our software, but we may have to look into now allowing that since this is becoming a reoccurring problem

dballard avatar Aug 29 '22 14:08 dballard

Hope this issue gets addressed, it's a vert essential feature that's needed. I just want users in my git to only use it to submit issues and having the fork means new user just make a fork and clear the stuff leading to a big abuse

red0888 avatar Nov 20 '22 08:11 red0888

Hello, this happened to our gitea instance as well, Users now are forking whatever repository they have access, then cleanup and use it as a new repo despite MAX_CREATION_LIMIT=0 .

gd197 avatar Dec 15 '22 07:12 gd197

Any updates on this? This is a 6 year old report...

lolcatw avatar Jan 27 '24 00:01 lolcatw

JFYI: chmod u-w,g-w,o-w gitea-repositories solved the issue))

qMBQx8GH avatar May 28 '24 13:05 qMBQx8GH