Skip to content

Commit

Permalink
Ignore wrong contest submissions in ProxyService
Browse files Browse the repository at this point in the history
When you are running cms with more than a contest (ie multicontest)
ProxyService can be notified by ScoringService of new submissions of any
contest, ignoring the `-c X` flag of PS. This will lead to `Inconsistent Data`
errors in RWS due to submissions of the wrong contest (bad user, bad
task, ...). This is especially bad because the wrong submission can be sent
with other valid submissions, and RWS drop them all.

The proposed fix just ignores those submissions from ProxyService since
ScoringService has no way to know which contest PS is bound to.
  • Loading branch information
edomora97 committed Nov 11, 2019
1 parent d4c9e92 commit 832781d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cms/service/ProxyService.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Copyright © 2015 Luca Versari <[email protected]>
# Copyright © 2015 William Di Luigi <[email protected]>
# Copyright © 2016 Amir Keivan Mohtashami <[email protected]>
# Copyright © 2019 Edoardo Morassutto <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -371,6 +372,10 @@ def operations_for_score(self, submission):
queues for them to be sent to rankings.
"""
# ScoringService sent us a submission of another contest.
if submission.task.contest_id != self.contest_id:
return []

submission_result = submission.get_result()

# Data to send to remote rankings.
Expand Down Expand Up @@ -407,6 +412,9 @@ def operations_for_token(self, submission):
queues for them to be sent to rankings.
"""
# ScoringService sent us a submission of another contest.
if submission.task.contest_id != self.contest_id:
return []
# Data to send to remote rankings.
submission_id = "%d" % submission.id
submission_data = {
Expand Down

0 comments on commit 832781d

Please sign in to comment.