Poll votes accept any sessionId from the client, so one session can vote in another
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 86/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- security
调研方向
阅读 apps/ws-server/src/utils/handleMessages.ts 中的 poll:vote 分支,以及 apps/ws-server/src/utils/handleMessages.poll.test.ts 中的相关测试。检查处理程序如何获取会话 ID 和参与者 ID,然后运行投票处理程序测试。完成标准是投票使用套接字的会话 ID 和参与者 ID,并且测试覆盖外部 ID。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- TypeScript
- 星标
- 21
- 派生
- 7
- 平均合并
- 11 小时 14 分钟
- 30 天内合并 PR
- 30
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TheCodeHeist-Coder/Rexial 的其他 Issue
-
Lint does not block a merge, and the same test step runs twice可能已有人在做 @spikedeeev 于 7 天前认领。 未关闭Backend first issue bug good first issue help wanted level1 nsoc26
难度 2/5 1-3 小时 新手友好度 82/100
TheCodeHeist-Coder/Rexial#243 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Add CodeQL and dependency scanning so a malicious or vulnerable dependency is caught可能已有人在做 @divyanshAgarwal123 于 9 天前认领。 未关闭Backend first issue enhancement help wanted level3 nsoc26
难度 2/5 半天 新手友好度 62/100
TheCodeHeist-Coder/Rexial#242 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
fix: validate types for login email and password (500 on non-string or missing body)可能重新可做 @spikedeeev 于 16 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
TheCodeHeist-Coder/Rexial#235 · 2 条评论 ·
维护者通常 1 天内回复
-
[Bug]: Poll voter loses their "You voted" state as soon as someone else votes可能已有人在做 @daocuong11 于 6 天前认领。 未关闭level2 nsoc26
难度 3/5 1-2 天 新手友好度 74/100
TheCodeHeist-Coder/Rexial#282 · 2 条评论 ·
维护者通常 1 天内回复
-
security: remediate the dependency baseline before enforcing the audit gate可能已有人在做 @divyanshAgarwal123 于 6 天前认领。 未关闭level2 nsoc26
难度 5/5 一周以上 新手友好度 25/100
TheCodeHeist-Coder/Rexial#266 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 TheCodeHeist-Coder/Rexial 的全部 Issue
相似的 Issue
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
难度 2/5 1-3 小时 新手友好度 82/100
openclaw/openclaw#212827 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Use one constant for the 10,000-character input limit可能已有人在做 @NginxL 今天认领。 未关闭good first issue refactor
难度 2/5 1-3 小时 新手友好度 78/100
aniru-dh21/snap-validate#51 ·
维护者通常 1 天内回复
-
dependencies effort: small good first issue priority: low
难度 1/5 1-3 小时 新手友好度 88/100
TMHSDigital/screencast-mcp#509 ·
维护者通常 1 天内回复
-
from-review tech-debt testing
难度 2/5 1-3 小时 新手友好度 82/100
blamechris/chroxy#9520 ·
维护者通常 1 天内回复