DOMjudge / domjudge

DOMjudge programming contest jury system
https://www.domjudge.org
GNU General Public License v2.0
719 stars 254 forks source link

PHP generation error when bad data in the database (Language) #350

Closed GuillaumeMilan closed 6 years ago

GuillaumeMilan commented 6 years ago

When you write bad data in the database (for example put a bad json format in the extension file in the declaration of a language), the language page becomes unmodifiable. And the only way to correct the language I found is to modify in the database manually.

To create the bug: domjudge/jury/languages.php create a language and put in the extensions field a non array data type like: .ext

Domjudge in this case create the language in the database even if the extension format is not json.

meisterT commented 6 years ago

While I agree that this is a bug and we should not accept invalid JSON there, I cannot reproduce the error. Regardless what garbage I enter in the extension field, the UI still let's me modify it later.

Is this reproducible on your side? What's the error, did the page stop rendering?

GuillaumeMilan commented 6 years ago

I just reproduced it on my modified server. But normally it's possible on normal server as I didn't modified this part. result

The information I gave to create the bug is

meisterT commented 6 years ago

Thanks, I was on the wrong branch...

Data should now be rejected if it's not a valid JSON array with at least one element.