Skip to content

fix(badges): reject tickets of another summit in badge print and can-print endpoints - #683

Open
romanetar wants to merge 1 commit into
mainfrom
fix/badge-print-summit-check
Open

romanetar wants to merge 1 commit into
mainfrom
fix/badge-print-summit-check

Conversation

@romanetar

@romanetar romanetar commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

ref: https://app.clickup.com/t/9014802374/1k5eh578t66

Summary

SummitOrderService::getAttendeeBadge replaced the summit received as parameter with the summit of the order right before comparing them:

$order = $ticket->getOrder();
$summit = $order->getSummit();   // overwrote the summit of the URL
if ($order->getSummitId() != $summit->getId())   // order's summit compared with itself
    throw new EntityNotFoundException('Ticket not found.');

The check never failed, so these endpoints answered for a ticket that belongs to a summit other than {id}, and printing marked the badge as printed:

  • PUT /api/v1/summits/{id}/tickets/{ticket_id}/badge/current/print
  • PUT /api/v1/summits/{id}/tickets/{ticket_id}/badge/current/{view_type}/print
  • GET /api/v1/summits/{id}/tickets/{ticket_id}/badge/current/print
  • GET /api/v1/summits/{id}/tickets/{ticket_id}/badge/current/{view_type}/print

The fix removes the reassignment, so a ticket of another summit answers 404 Ticket not found. The view type is still resolved on the summit of the URL.

Tests

New tests in OAuth2SummitTicketsApiTest (10 cases):

  • print and can-print, default and by view type, called through the URL of another summit, by ticket id and by ticket number: expect 404, and for print no badge print is recorded.
  • control: the same ticket through the URL of its own summit still answers 200 / 201.

The fixture also allows the other summit's view type in the badge type (worst case), so on main the printing rules alone do not stop the call. The 8 other-summit cases fail on main (print answers 201, can-print answers 200) and pass with the change. The whole OAuth2SummitTicketsApiTest class passes (51 tests).

Notes

  • Without that worst-case setup the printing rules already reject most cross-summit calls with 412, because badge types only allow view types of their own summit. The missing check was still a real gap.
  • Not changed here: OAuth2SummitTicketApiController::getAttendeeBadge uses is_int($ticket_id) on a route parameter, which is always a string. To be handled separately if confirmed.

…print endpoints

getAttendeeBadge replaced the summit received as parameter with the summit
of the order right before comparing them, so the check compared the order's
summit with itself and never failed. The print and can-print badge endpoints
answered for a ticket that belongs to a summit other than the one in the URL,
and printing marked the badge as printed.

Remove the reassignment so the order's summit is compared with the summit in
the URL and a mismatch answers 404 Ticket not found.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b08a49e0-e6be-451a-83d3-88144c8c52cb
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@romanetar romanetar self-assigned this Nov 27, 2026
@github-actions

Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-683/

This page is automatically updated on each push to this PR.

@romanetar
romanetar requested a review from smarcet November 27, 2026 15:49

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant