-
Notifications
You must be signed in to change notification settings - Fork 2
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
solutions/forms.py should use task.max_file_size if uploaded solution is a zip-file in an other way. #15
Comments
The problem that I see with this method is that it doesn't protect against zip bombs as good as before. An example: this now allows a zip file to contain a large number of files with 0 bytes in size as well as one easily compressible large file. Sure, there is still a limit. But I'm not sure if that's effective anymore. Maybe something like |
Well , in our Praktomat instance for Database Lecture, our students should include not only UTF8-encoded textfiles inside their submissions but also some binary files like PDF or JPG. Perhaps introcuding |
In that case, this should matter even less as JPG itself is already a compressed file format. Contained in a ZIP file, you're not likely to compress the file by a lot. About the same should be true for PDF. Then you're hitting the Introducing another parameter for a task would just add unnecessary complexity here in my opinion. Or am I missing something important? |
Hannesbraun wrote in #15 (comment) :
What is the semantical reason to use "8" in above condition? Just a funny view, the code-snippet |
Without the surrounding That's the reason I'm limiting the number of files in that calculation to 8. It means that if the sum of file sizes is bigger than I hope this explanation makes a bit more sense. If not, let me know :)
What a happy accident ;) |
Hannes wrote.
Well, if |
Of course, yes. Somehow, I got it mixed up... Thanks for noticing. |
Fixed in #24 |
Currently HSO-Praktomat blocks Zip-files which are bigger than task.max_file_size.
praktomat/src/solutions/forms.py
Line 50 in 19c2c6f
If one add
n
single non-zip-files as solution than the upload limit isn*max_file_size
.Therefor I think a possible fix is:
change solutions/forms.py L50
from
if sum(fileinfo.file_size for fileinfo in zip.infolist()) > max_file_size:
to
if sum(fileinfo.file_size for fileinfo in zip.infolist()) > (max_file_size * len(zip.infolist()):
(cf. KITPraktomatTeam/Praktomat#359 )
The text was updated successfully, but these errors were encountered: