Add configurable max output limit for site-managed problems#2452
Open
AdhamAbouaita wants to merge 2 commits intoDMOJ:masterfrom
Open
Add configurable max output limit for site-managed problems#2452AdhamAbouaita wants to merge 2 commits intoDMOJ:masterfrom
AdhamAbouaita wants to merge 2 commits intoDMOJ:masterfrom
Conversation
Prevent users from setting excessively large output limits (e.g., 2GB) that can crash judge servers. Adds DMOJ_PROBLEM_MAX_OUTPUT_LIMIT setting (default 100MB) and MaxValueValidator on ProblemData and ProblemTestCase output_limit fields, validated on save via existing ModelForm flow.
quantum5
requested changes
Mar 28, 2026
| migrations.AlterField( | ||
| model_name='problemdata', | ||
| name='output_limit', | ||
| field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(104857600)], verbose_name='output limit length'), |
Member
There was a problem hiding this comment.
I love the pretense that this is actually configurable.
Author
There was a problem hiding this comment.
I removed the migration file entirely since validators are enforced in Python at the form level, not at the database level, so I felt it was a no-op that just hardcoded the limit value without actually doing anything useful.
Validators are enforced in Python, not at the DB level, so this migration produced no SQL. Removing it to avoid a misleading hardcoded value in the migration snapshot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature: Limits output sizes to prevent judge server crashes.
Implementation: Added DMOJ_PROBLEM_MAX_OUTPUT_LIMIT (default 100MB) and applied MaxValueValidator to ProblemData and ProblemTestCase fields.
Migration: Added 0153_problem_data_output_limit_validator.py to sync Django’s state. While it generates no SQL, it prevents makemigrations from flagging missing validators in future runs.
Closes #2447