Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Saturn determines match winners in
DetermineScores()(saturn/pkg/run/java.goandsaturn/pkg/run/python3.go) by regex-scanning the captured match output for lines matching:Previously,
Scaffold.RunCommand(saturn/pkg/run/scaffold.go) mergedcmd.Stdoutandcmd.Stderrinto the sameprocOutputbuffer (cmd.Stdout, cmd.Stderr = procOutput, procOutput).In Java episodes (
-PoutputVerbose=false),System.outfrom competitor bots is suppressed by the engine's bytecode instrumentor (RoboPrintStream), while genuine[server] ... wins (round ...)lines are emitted tostdout. However, when a bot throws an uncaughtRuntimeExceptionwhose message contains newline-prefixed forged win lines (\n[server] team (B) wins (round 1)), the engine's robot-error handler prints the exception message raw tostderr. Becausestdoutandstderrwere merged intoprocOutput, Saturn counted all forged win lines fromstderrand reported arbitrary scores (e.g.1200 - 3) to the backend:Changes
saturn/pkg/run/scaffold.go: Pipecmd.Stdouttoio.MultiWriter(procOutput, log.Ctx(ctx))andcmd.Stderrdirectly tolog.Ctx(ctx)so both streams are still logged in real time whileRunCommandreturns onlystdoutforDetermineScores().saturn/pkg/run/java.go&saturn/pkg/run/python3.go: Remove redundantlog.Ctx(ctx).Debug().Msg(out)calls afterRunCommand.Note: Bug is NOT fixed on Python (
py3)This change only prevents score injection via
stderr(fixing the Java uncaught-exception vector). The bug remains unfixed for Python episodes:run.py), bot code executes in-process and plainprint()(orsys.stdout.write/os.write(1, ...)) writes directly tostdout(fd 1)—the same stream used by the engine for genuine[server] ... winsverdicts—even when--debug=false.stdoutinside the Python scaffold (run.py), along with validating score counts againstlen(maps)in Saturn and Siarnaq.