AOSSIE-Org / AOSSIE-Org/DebateAI
[FEATURE]: /profile Elo update endpoint lets any authenticated client set arbitrary users' ratings
- 主要言語
- TypeScript
- スター
- 84
- フォーク
- 198
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 30
説明
### Feature and its Use Cases
## Description
`UpdateEloAfterDebate` in `backend/controllers/profile_controller.go` (lines 352-381) reads `winnerId` and `loserId` straight from the request body and updates both users' ratings with no verification that:
- the caller was a participant in any debate,
- a debate between those users actually happened,
- the caller isn't naming themselves as winner repeatedly.
It is also a plain FindOne → `$set` read-modify-write with no transaction, so concurrent calls lose updates.
### Additional Context
## Impact
Any logged-in user can farm rating (or zero out other players) with a few `curl` calls, making the leaderboard meaningless.
## Suggested Fix
Derive winner/loser server-side from the stored debate result (the websocket/judge flow already knows the outcome) and remove the client-supplied IDs. Use an atomic update (`$inc` or optimistic concurrency on a version field).
### Code of Conduct
- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start in backend/controllers/profile_controller.go at UpdateEloAfterDebate (lines 352-381), then trace the websocket/judge flow and the stored debate result it uses. Review the current FindOne → $set path and verify that completion derives the outcome server-side, prevents unauthorized rating changes, and preserves concurrent updates.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- go, mongodb
- 領域
- authorization, backend, databases, security
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100