[Bug]: Client-supplied timeMs is trusted when awarding points
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- redis, typescript
Direzione di ricerca
Start in apps/ws-server/src/utils/handleMessages.ts, in the quiz:submit-answer handler, where points are computed from the client's timeMs. Read timeManager.ts to see how quiz:deadline:<sessionId> is stored in Redis, since the server-side elapsed time and the late-answer check depend on it. Done means a crafted timeMs no longer changes the score, late or non-current-question answers score nothing or are rejected, and honest scores are unchanged. Pull request #163 is already open against this issue, so check it before starting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happened?
Scoring uses a value the client computes and sends.
apps/frontend/src/screens/LiveQuiz.tsx:265:
const timeMs = Date.now() - questionStartTime;
apps/ws-server/src/utils/handleMessages.ts, in quiz:submit-answer:
const points = isCorrect ? Math.max(10, 1_000 - timeMs) : 0;
Anyone can send timeMs: 0 and score the maximum 1000 points on every question
regardless of how long they actually took. A negative value is not rejected
either.
There is a second, subtler problem: the server never checks that the question is
still open. A late answer — after the timer expired, or for a previous question
— is accepted and scored, as long as no row exists yet for that
(participantId, questionId).
Steps to reproduce
Suggested fix. The server already knows the deadline. timeManager.ts writes
quiz:deadline:<sessionId> to Redis, which is exactly what is needed:
- Compute elapsed time server-side from the stored deadline and the question's
timeLimit, and ignoretimeMsfrom the payload entirely - Reject a submission whose
questionIdis not the session's current question - Reject a submission arriving after the deadline has passed
Definition of done:
- A crafted
timeMs: 0no longer affects the score - An answer submitted after the timer expires scores nothing
- An answer for a non-current question is rejected
- Honest clients see no change in their scores
Worth pairing with issue 1 — same file, same handler, and both are about not
trusting the client.
Which part of Rexial?
ws-server (WebSockets), http-server (Express REST API)
How are you running Rexial?
Docker Compose (docker-compose up)
Logs or error output
Environment
No response
Before submitting
- I searched existing issues and this has not been reported
- I am not including any secrets, API keys or passwords in this report
- Lingua principale
- TypeScript
- Stelle
- 21
- Fork
- 7
- Merge medio
- 5h 19m
- PR unite (30g)
- 29
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TheCodeHeist-Coder/Rexial
-
bug good first issue help wanted UI & UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TheCodeHeist-Coder/Rexial#205 ·
I maintainer di solito rispondono entro 1 giorno
-
The join endpoint returns an error shape the frontend cannot readForse già presa @Anshuu2004 l’ha presa 2 giorni fa. ApertaBackend first issue bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
TheCodeHeist-Coder/Rexial#192 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Registering without a password returns a 500 instead of telling you what is missingForse già presa @Anshuu2004 l’ha presa 3 giorni fa. ApertaBackend first issue bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
TheCodeHeist-Coder/Rexial#191 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue help wanted UI & UX
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
TheCodeHeist-Coder/Rexial#178 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted UI & UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
TheCodeHeist-Coder/Rexial#175 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TheCodeHeist-Coder/Rexial
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
VictoriaMetrics/victorialogs-datasource#747 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
bug from-studio
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
esengine/DeepSeek-Reasonix#14608 ·
I maintainer di solito rispondono entro 1 giorno
-
triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
getarcaneapp/arcane#4590 ·
I maintainer di solito rispondono entro 1 giorno
-
支持对已取消(cancelled)任务生成报告Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
Clouditera/VulnHunter#57 ·