JJ-8 / CTFNote

CTFNote is a collaborative tool aiming to help CTF teams to organise their work. This tool helps making notes during CTFs, so you can track your CTF notes at a later time. This is similar to the CTF pad seen in one of the video's of Liveoverflow.
GNU General Public License v3.0
9 stars 2 forks source link

Increase upload size limit #97

Closed markfijneman closed 4 months ago

markfijneman commented 5 months ago

The current limit (1MB, which is the default value of nginx) is not enough for a lot of screenshots taken on screens with high resolutions. Attempting to upload a screenshot bigger than 1MB results in the following error from /pad/uploadimage: "413 Request Entity Too Large - nginx". Currently I would have to modify the image trough an external editor to make it smaller, which is not really preferable during a CTF where you have limited time to solve challenges.

I think increasing the limit to 5MB would alleviate this problem in most cases. The following change to /front/nginx.conf resolved the problem on my own instance:

diff --git a/nginx.conf b/nginx-2.conf
index 552f448..5a177c7 100644
--- a/nginx.conf
+++ b/nginx-2.conf
@@ -62,5 +62,6 @@ server {
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         add_header Pragma "no-cache";
+        client_max_body_size 5M;
     }
 }
JJ-8 commented 5 months ago

The outer-nginx config should also be updated, right? So the nginx version that is served on the host with the configuration described in the README.

markfijneman commented 4 months ago

On my instance changing the inner-nginx config was enough, but that might only work with my specific setup. Could you test it yourself to see what happens?

JJ-8 commented 4 months ago

I think it won't hurt to increase the client_max_body_size value by default. Testing on production it is a bit difficult without a ghcr container (and locally I don't have an outer-nginx enabled). I think we just should open a PR to update the inner and outer nginx config to set these values to 5M.