Poll votes accept any sessionId from the client, so one session can vote in another
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 86/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- security
Línea de trabajo
Lee el caso poll:vote en apps/ws-server/src/utils/handleMessages.ts y sus pruebas en apps/ws-server/src/utils/handleMessages.poll.test.ts. Comprueba cómo obtiene el handler los ID de sesión y de participante y, después, ejecuta las pruebas del handler de encuestas. El trabajo estará terminado cuando los votos usen los ID de sesión y de participante del socket y las pruebas cubran ID ajenos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happens
poll:vote is the only poll handler that does not check the socket's own session. Every other one calls authorizeOrganizerAction, which binds the action to client.sessionId. The vote handler reads sessionId straight out of the message payload:
// apps/ws-server/src/utils/handleMessages.ts
case 'poll:vote': {
const { sessionId, pollId, optionId, participantId } = payload;
const voterId = client.participantId || participantId;
if (!voterId || !sessionId || !pollId || !optionId) break;
const result = votePoll(sessionId, pollId, optionId, voterId);
Compare with the helper every other poll handler uses:
// apps/ws-server/src/utils/organizerAuth.ts
if (payload?.sessionId && payload.sessionId !== client.sessionId) {
sendError(client, "SESSION_MISMATCH", "This message is for a different session.");
return null;
}
Why it matters
A participant joined to session A can send poll:vote with session B's id. If they can guess or observe a poll id in another session, their vote lands there. votePoll looks the poll up purely by the payload's sessionId and never asks whether the socket belongs to it.
The vote also broadcasts to the other session, so participants in B see a vote count move for someone who was never in the room.
Reproducing
- Join session A as a participant
- Have a host start a poll in session B, note its
pollIdandsessionId(both are in thepoll:startedbroadcast to B's participants) - From A's socket send
{ type: 'poll:vote', payload: { sessionId: B, pollId: B's poll, optionId: ..., participantId: <A's id> } } - The vote is counted in B
The fix
Use the socket's own session, the same as every other handler:
case 'poll:vote': {
if (!client.sessionId || !client.participantId) break;
const { pollId, optionId } = payload;
if (!pollId || !optionId) break;
const result = votePoll(client.sessionId, pollId, optionId, client.participantId);
Note the second half: client.participantId || participantId also lets a client supply someone else's participant id when the socket has none, which both ballot-stuffs and overwrites another player's vote. The id should come only from the socket, which is set at join time.
A test in apps/ws-server/src/utils/handleMessages.poll.test.ts should cover both: a vote with a foreign sessionId is refused, and a vote with a foreign participantId is attributed to the socket's own participant.
Files
apps/ws-server/src/utils/handleMessages.ts— thepoll:votecaseapps/ws-server/src/utils/handleMessages.poll.test.ts— tests
- Lenguaje dominante
- TypeScript
- Estrellas
- 21
- Forks
- 7
- Merge medio
- 11 h 14 min
- PR fusionados (30 d)
- 30
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TheCodeHeist-Coder/Rexial
-
Lint does not block a merge, and the same test step runs twicePosiblemente ocupada @spikedeeev la tomó hace 7 días. AbiertoBackend first issue bug good first issue help wanted level1 nsoc26
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
TheCodeHeist-Coder/Rexial#243 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Add CodeQL and dependency scanning so a malicious or vulnerable dependency is caughtPosiblemente ocupada @divyanshAgarwal123 la tomó hace 9 días. AbiertoBackend first issue enhancement help wanted level3 nsoc26
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
TheCodeHeist-Coder/Rexial#242 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
fix: validate types for login email and password (500 on non-string or missing body)Quizá libre de nuevo @spikedeeev la tomó hace 16 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
TheCodeHeist-Coder/Rexial#235 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Bug]: Poll voter loses their "You voted" state as soon as someone else votesPosiblemente ocupada @daocuong11 la tomó hace 6 días. Abiertolevel2 nsoc26
Dificultad 3/5 1-2 días Aptitud para principiantes 74/100
TheCodeHeist-Coder/Rexial#282 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
security: remediate the dependency baseline before enforcing the audit gatePosiblemente ocupada @divyanshAgarwal123 la tomó hace 6 días. Abiertolevel2 nsoc26
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
TheCodeHeist-Coder/Rexial#266 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de TheCodeHeist-Coder/Rexial
Issues similares
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
openclaw/openclaw#212827 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Use one constant for the 10,000-character input limitPosiblemente ocupada @NginxL la tomó hoy. Abiertogood first issue refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
aniru-dh21/snap-validate#51 ·
Los mantenedores suelen responder en 1 día
-
dependencies effort: small good first issue priority: low
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
TMHSDigital/screencast-mcp#509 ·
Los mantenedores suelen responder en 1 día
-
from-review tech-debt testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
blamechris/chroxy#9520 ·
Los mantenedores suelen responder en 1 día