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

Aperta
#3,762 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Abhrant-Singh ci sta già lavorando.

Dal 9/11/2026.

  • #3769 di @Abhrant-Singh — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.

Lingua principale
Python
Stelle
158
Fork
110
Merge medio
1g 11h
PR unite (30g)
115

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OWASP/cornucopia

Tutte le issue di OWASP/cornucopia

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.