Skip to content

Hide queue connection details in competition details API - #2581

Merged
ObadaS merged 1 commit into
developfrom
queue_in_competition_detail_api
Sep 29, 2026
Merged

ObadaS merged 1 commit into
developfrom
queue_in_competition_detail_api

Conversation

@ihsaan-ullah

@ihsaan-ullah ihsaan-ullah commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The competition details API now returns only the queue's id and name, so queue connection details (broker URL, credentials and vhost) and the queue's owner and organizers are no longer included.

Add tests confirming this for logged-out users, competition creators who don't own the queue, and competition creators who own the queue.

Issues this PR resolves

  • reported by: Thomas Moreau and EEG Foundation Challenge

A checklist for hand testing

  • Use a non-default queue and check that the compeititon api (api/competitions/ID) do not return sensitive queu information in the response.

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

@ihsaan-ullah ihsaan-ullah changed the title Hide queue connection details in competition details Hide queue connection details in competition details API Sep 28, 2026
@tomMoral

Copy link
Copy Markdown
Contributor

Thanks for the quick fix. Nice that it's an unconditional field swap rather than a permission branch, this makes it more fail proof.

Note that the full QueueSerializer is still left nested in CompetitionSerializer.queue and could re-expose the broker URL after an unrelated changes. This base class isn't returned by any current read action (the create/update subclasses set queue = None, and the viewset never returns the base directly), so it's not a live leak today. But it's a trap: any future GET route that returns CompetitionSerializer(...).data would leak broker_url again. You could make queue write-only here (or using QueuePublicSerializer for representation): the create/associate path only needs the queue id inbound, never the full object outbound.

  1. There is a dead PageSerializer.competition monkey-patch. 'competition' isn't in PageSerializer.Meta.fields, so this attribute never renders (I confirmed the live pages[] output only contains id/title/content/index). It's currently harmless but is exactly the kind of nested CompetitionSerializer → QueueSerializer path that would silently re-expose credentials if someone later adds 'competition' to the page fields. You could delete the assignment and its comment.

The competition details API now returns only the queue's id and name,
so queue connection details (broker URL, credentials and vhost) and
the queue's owner and organizers are no longer included.

Add tests confirming this for logged-out users, competition creators
who don't own the queue, and competition creators who own the queue.
@ObadaS
ObadaS force-pushed the queue_in_competition_detail_api branch from f4ca903 to fc271d7 Compare September 29, 2026 10:42
@ObadaS

ObadaS commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the quick fix. Nice that it's an unconditional field swap rather than a permission branch, this makes it more fail proof.

Note that the full QueueSerializer is still left nested in CompetitionSerializer.queue and could re-expose the broker URL after an unrelated changes. This base class isn't returned by any current read action (the create/update subclasses set queue = None, and the viewset never returns the base directly), so it's not a live leak today. But it's a trap: any future GET route that returns CompetitionSerializer(...).data would leak broker_url again. You could make queue write-only here (or using QueuePublicSerializer for representation): the create/associate path only needs the queue id inbound, never the full object outbound.

2. There is a dead PageSerializer.competition monkey-patch. 'competition' isn't in PageSerializer.Meta.fields, so this attribute never renders (I confirmed the live pages[] output only contains id/title/content/index). It's currently harmless but is exactly the kind of nested CompetitionSerializer → QueueSerializer path that would silently re-expose credentials if someone later adds 'competition' to the page fields. You could delete the assignment and its comment.

The automated tests added in this PR will ensure that these scenarios doesn't happen. The tests will fail, making us take a look to see what went wrong, giving us an opportunity to fix it before the changes are merged.

@ObadaS
ObadaS merged commit ab76362 into develop Sep 29, 2026
1 check passed
@ObadaS
ObadaS deleted the queue_in_competition_detail_api branch September 29, 2026 10:53
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.

3 participants