pc2ccs / pc2v9

Version 9 of the PC^2 Programming Contest Control System
Eclipse Public License 2.0
46 stars 23 forks source link

Non-compliant handling of CLICS PAUSE contest time Event Feed message #795

Closed johnbrvc closed 1 year ago

johnbrvc commented 1 year ago

Describe the issue: It was reported by ECPC that the CDS returned:

"CCS error: Error setting contest start time (Extra data in contest patch request) (500) I get this message when pausing contest time from ADMIN panel in cds web app"

This is caused by the message sent to PC2 containing more than 2 items in the JSON record (ContestService.setStarttime()). PC2 expects only "id" and "start_time". If the optional "countdown_pause_time" is included, this causes the JSON record to have 3 items, and an error is returned to the client as described above, the "extra data" being the extra "countdown_pause_time" property in the JSON object. The CDS sends the "countdown_pause_time" property if the contest is paused before it starts.

        // verify the JSON didn't contain any OTHER key/value information
        if (requestMap.size() != 2) {
            controller.getLog().log(Log.WARNING, "Contest Service PATCH: JSON input contains illegal extra data: '" + jsonInputString + "'");
            // return HTTP 400 response code per CLICS spec
            return Response.status(Status.BAD_REQUEST).entity("Extra data in contest patch request").build();
        }

To Reproduce: Send a PAUSE contest message with the optional countdown_pause_time property in the JSON message. Setting up a CDS and causing it to generate the message may be one way to do this.

Expected behavior: PC2 should ignore the "countdown_pause_time" property, or, perhaps, make use of it in a GUI display.

Actual behavior: A web 500 error is returned to the user as described above.

Environment: All

Log Info: (Asked for the PC2 log from ECPC, no response).

Screenshots:

Additional context: Check for presence of the "countdown_pause_time" property and allow it.

lane55 commented 1 year ago

This is next contest because a PAUSE may happen at the finals (as described in the issue)

nickygerritsen commented 1 year ago

Note that it will probably not happen at the finals, since PC2 should be reading from DOMjudge, not the CDS and DOMjudge does not support countdown_pause_time so we will not pass it on the feed to any shadow systems.

johnbrvc commented 1 year ago

Note that it will probably not happen at the finals, since PC2 should be reading from DOMjudge, not the CDS and DOMjudge does not support countdown_pause_time so we will not pass it on the feed to any shadow systems.

Does that mean you just won't send that property, or, you won't send the PATCH message (PAUSE) at all?

nickygerritsen commented 1 year ago

Note that it will probably not happen at the finals, since PC2 should be reading from DOMjudge, not the CDS and DOMjudge does not support countdown_pause_time so we will not pass it on the feed to any shadow systems.

Does that mean you just won't send that property, or, you won't send the PATCH message (PAUSE) at all?

We don't forward PATCH messages, but we WILL send a contest event on the feed with the new data (so a null start_time`). We can't even send the PATCH message I think, since we have no knowledge of where to send it to.