bug(copi): next_round and toggle_continue_vote can be triggered on unstarted or finished games

オープン
#3,762 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Abhrant-Singh がすでに取り組んでいます。

2026年11月9日 から。

  • #3769 @Abhrant-Singh による — オープン

評価

この issue はまだ評価されていません。

説明

Describe the bug

In copi.owasp.org/lib/copi_web/live/player_live/show.ex, while toggle_vote verifies that a game is active before accepting votes (via PR #3662), next_round and toggle_continue_vote do not check game.started_at or game.finished_at.

As a result:

  • On unstarted games: A player in the lobby can trigger next_round. Because cards haven't been dealt yet, last_round? evaluates to true, which immediately sets finished_at and ends the game session before the host can start it.
  • On finished games: Players can continue calling next_round and toggle_continue_vote, modifying database state and advancing rounds_played on a completed game.
Code Reference

In copi.owasp.org/lib/copi_web/live/player_live/show.ex:

  • handle_event("next_round", ...) (lines 122–152)
  • handle_event("toggle_continue_vote", ...) (lines 155–192)

Neither handler checks is_nil(game.started_at) or not is_nil(game.finished_at), unlike handle_toggle_vote in the same file.

Expected Behavior

Both events should require the game to be active (not is_nil(game.started_at) and is_nil(game.finished_at)), matching Copi.Cornucopia.Game.active?/1 and rejecting calls on unstarted or finished games with a flash notice.

Proposed Solution

Add the existing lifecycle guard checks to both handlers in player_live/show.ex and add LiveView regression tests in show_test.exs.

主要言語
Python
スター
158
フォーク
110
平均マージ
1日 11時間
マージ済み PR(30日)
115

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OWASP/cornucopia のほかの issue

OWASP/cornucopia の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。