jdabtieu / CTFOJ

Lightweight CTF judge platform for capture-the-flag (CTF) clubs
GNU Affero General Public License v3.0
10 stars 5 forks source link

[BUG] instancer api endpoints allowed even if problem is not instanced #237

Closed jdabtieu closed 12 months ago

jdabtieu commented 1 year ago

Describe the bug

When a problem does not have instancer=True, users can still hit the /api/instancer/* endpoints

Expected Behavior

Should return an error message saying that the problem is not instanced

Current Behavior

It makes a bad request to the instancer, which will return an error, but we can remove this unnecessary call if we just check earlier on

Possible Solution

Add a check to make sure the problem is instanced, in the 3 instancer routes in api.py

PedramHaeri commented 1 year ago

Hi I would like to try and fix this issue. could you please assign it to me?

jdabtieu commented 1 year ago

Absolutely! I've assigned the issue.

The relevant SQL schema can be found in tables problem and contest_problem in INSTALL.sh, and the views themselves reside in views/api.py

jdabtieu commented 12 months ago

Fixed via #238 and 887d37b7a5e7d1d6bb0e981ede2bc189eea7e84d