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

Max file size limit for non-LFS #24

Open
muehlhaus opened this issue May 28, 2024 · 2 comments
Open

Max file size limit for non-LFS #24

muehlhaus opened this issue May 28, 2024 · 2 comments

Comments

@muehlhaus
Copy link
Member

The Git non-LFS part is important for metadata development. Therefore, we should limit the file size for non-LFS object.

@eik-dahms
Copy link

Except for the UI admin settings I could find nothing in the docs regarding limiting file sizes. I also checked gitlab.rb and could find nothing of these sorts.

So I at least tried the UI settings Maximum attachment size and Maximum push size:

Admin_Area>Settings>General>Account and Limit

  • Maximum attachment size (MiB)
    • does work for attachments in comments
    • does not work (at least for me, maybe somebody can double check) for uploading files; although documentation clearly states:

When you add files to a repository through the web UI, the maximum attachment size is the limiting factor, because the web server must receive the file before GitLab can generate the commit. Use Git LFS to add large files to a repository. This setting does not apply when pushing Git LFS objects.

  • Maximum push size (MiB)
    • only works for actually pushing commits - that excludes uploading files via Web and Web_IDE - I assume because the files get uploaded+commited directly - no need for push.

finally I wrote a pre-receive hook which checks file uploads via web and web-ide:
https://gist.github.com/eik-dahms/46e626fe8747f14a31d9db128dd79b42

This can be used to limit the file size or even block these web uploads completely. Still - there is the problem, that if a user uploads a lot of small files that are too big in total, it would still be allowed.

Maybe it would also be possible to check if files in certain directories like the data folder in assay are lfs tracked.

When I find the time I could also integrate this into the docker image.

@TetraW
Copy link
Collaborator

TetraW commented Jun 21, 2024

Except for the UI admin settings I could find nothing in the docs regarding limiting file sizes. I also checked gitlab.rb and could find nothing of these sorts.

So I at least tried the UI settings Maximum attachment size and Maximum push size:

Admin_Area>Settings>General>Account and Limit

* Maximum attachment size (MiB)
  
  * does work for attachments in comments
  * does **not** work (at least for me, maybe somebody can double check) for uploading files; although documentation clearly states:

When you add files to a repository through the web UI, the maximum attachment size is the limiting factor, because the web server must receive the file before GitLab can generate the commit. Use Git LFS to add large files to a repository. This setting does not apply when pushing Git LFS objects.

* Maximum push size (MiB)
  
  * only works for actually pushing commits - that excludes uploading files via Web and Web_IDE - I assume because the files get uploaded+commited directly - no need for push.

finally I wrote a pre-receive hook which checks file uploads via web and web-ide: https://gist.github.com/eik-dahms/46e626fe8747f14a31d9db128dd79b42

This can be used to limit the file size or even block these web uploads completely. Still - there is the problem, that if a user uploads a lot of small files that are too big in total, it would still be allowed.

Maybe it would also be possible to check if files in certain directories like the data folder in assay are lfs tracked.

When I find the time I could also integrate this into the docker image.

I found the same thing. Also double-checked the behavior you described for the maximum attachment size, which clearly does not behave as described.

We are currently looking into this problem and will probably set a maximum push size and make use of the pre-receive hook you provided. Thank you!

We would also be happy to receive suggestions about a sensible file size limit and whether it makes sense to deactivate web uploads altogether.

I also do not see an easy solution regarding the concern that a user may upload numerous small files which exceed result in a repository size which is unreasonable, as limiting the repository size seems to include LFS files. But I don't know if this will be an issue in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants