Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: fix OI mode contest bug seeing the judging result when shouldn't #860

Merged
merged 2 commits into from
Aug 12, 2024

Conversation

langningchen
Copy link
Contributor

Contest attendees should not see the submission results in OI contest mode, but the results are leaked in the raw data.

The tsdoc object, which includes the submission results, should not be returned to the client if canViewRecord is false. The issue could make the OI mode contest unfair and become an IOI contest.


View in the webpage UI:
image

View in the raw JSON:
image

A sample hacker (copied from an decompiled extend userscript):

async function PredictScore() {
      if (BasicMain.pageName() !== "record_detail") return;
      await new Promise(resolve => BasicMain.on("record_detail.prepare", () => resolve()));
      if (!UiContext.tdoc || UiContext.tdoc.rule !== "oi" || UiContext.rdoc.status) return;
      let ContestID = UiContext.tdoc._id,
          ProblemID = UiContext.pdoc.docId;
      if (!UiContext.tdoc.pids.includes(ProblemID)) return;
      let ProblemList = await WebRequestClass.get(`/d/${BasicMain.getDomainId()}/contest/${ContestID}/problems`).query({ _: Date.now() }),
          Record = Object.fromEntries(ProblemList.body.tsdoc.journal.map(Problem => [Problem.rid, Problem]))[UiContext.rdoc._id];
      if (typeof Record?.score == "number") {
          $(".section.side > .section__body").append(`
              <dl class="large horizontal" id="summary">
                  <dt>预估分数 <a href="javascript:;" class="exhloj-expect-score"><span class="icon icon-help"></span></a></dt>
                  <dd>${Record.status === 0 ? "努力预测中" : Record.score}</dd>
              </div>
          `);
          $(document).on("click", ".exhloj-expect-score", () => new Hydro.components.InfoDialog({
              $body: "预估分数是 Extend HLOJ 插件的 @exhloj/contest-helper 模块提供的 AI 智能分数预测功能。"
          }).open())
      }
  }

Copy link

hydro-dev-bot bot commented Aug 12, 2024

Thank you for your submission, we really appreciate it.
Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

Comment I have read the CLA Document and I hereby sign the CLA below to sign it.

@langningchen
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@langningchen
Copy link
Contributor Author

  • CVSS scoring: High 7.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
  • Affecting version: <=4.14.0
  • CWE: CWE-200

@pandadtdyy
Copy link
Member

So can you give us a copy with @exhloj/contest-helper to help us find more bug about it? You can send it to [email protected]

@undefined-moe undefined-moe merged commit e274330 into hydro-dev:master Aug 12, 2024
6 checks passed
@langningchen

This comment was marked as outdated.

@langningchen
Copy link
Contributor Author

langningchen commented Aug 12, 2024

So can you give us a copy with @exhloj/contest-helper to help us find more bug about it? You can send it to [email protected]

Hi! I found that the email could not be delivered because the attachments I added (which are two JavaScript files) violate your Secure Attachment Policy. Maybe you can contact me by WeChat or other social medias.

image

@pandadtdyy
Copy link
Member

So can you give us a copy with @exhloj/contest-helper to help us find more bug about it? You can send it to [email protected]

Hi! I found that the email could not be delivered because the attachments I added (which are two JavaScript files) violate your Secure Attachment Policy. May be you can contact me by WeChat or other social medias.

image

try with [email protected]?

@langningchen
Copy link
Contributor Author

So can you give us a copy with @exhloj/contest-helper to help us find more bug about it? You can send it to [email protected]

Hi! I found that the email could not be delivered because the attachments I added (which are two JavaScript files) violate your Secure Attachment Policy. May be you can contact me by WeChat or other social medias.
image

try with [email protected]?

It seems that the sending was successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants