hzxie / voj

A cross-platform online judge system based on Spring MVC framework and ActiveMQ.

Home Page:https://verwandlung.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I prohibit a participant from sending the same code several times?

stetsko-andrew-v opened this issue · comments

How can I prohibit a participant from sending the same code several times?

What do you mean? I don't understand.

We want to start contest on VOJ and we want to secure from DDoS and we want that contestant can't send one program code several times.

The whole system is protected by CSRF.
I think the code may not be submitted several times.

Yes, we know about CSRF. But we want that contestant can't send 2 or more time same code, becouse we want to use it in our school where pupils DDoS our site.

But the button is disabled after submitting. How to submit the code more than once?
One solution is to compare the code with the previous ones. If the newly submitted code is the same as the previous one, ignore the code.
What do you think?

The contestant can publish a partial solution and throw it several times and because of this voj.judger may not work (collapse)

I have edited SubmissionService.java but can't compile(error)
SubmissionService.java:

private Map<String, ? extends Object> getSubmissionCreationResult(Submission submission, boolean isCsrfTokenValid) {
		Map<String, Boolean> result = new HashMap<>(6, 1);
		String code = submission.getCode();
		List submissionsofthisuser = getSubmissions(submission.getProblem(), submission.getUser().getUsername());
		Boolean isCodeLikePrevious = false;
		for (Submission submissionp : submissionsofthisuser){
			if(submissionp.getCode() == code){ isCodeLikePrevious = true; break;}
		}
		result.put("isUserLogined", submission.getUser() != null);
		result.put("isProblemExists", submission.getProblem() != null);
		result.put("isLanguageExists", submission.getLanguage() != null);
		result.put("isCodeEmpty", code == null || code.length() == 0);
		result.put("isCsrfTokenValid", isCsrfTokenValid);
		result.put("isCodeLikePrevious", isCodeLikePrevious);
		boolean isSuccessful = result.get("isUserLogined")	&&  result.get("isProblemExists") &&
							   result.get("isLanguageExists") && !result.get("isCodeEmpty")	 &&
							   result.get("isCsrfTokenValid") && !result.get("isCodeLikePrevious");
		result.put("isSuccessful", isSuccessful);
		return result;
	}

Please provide the corresponding logs.

Closed due to inactivity.