Commit Graph

11 Commits

Author SHA1 Message Date
Sam Dornan
09bbfe515d refactor(netplay): reuse the shared rom visibility guard
Review follow-ups on the authorization work.

The listing carried its own copy of the ROM visibility decision. The shared
`assert_rom_visible` already masks a hidden ROM as a missing one, so the route
uses that instead and a private duplicate disappears. Hidden and unknown ids
now answer 404 rather than `200 {}`, which the in-tree client already maps to
no rooms.

The socket module's docstrings are cut to the one sentence each that carries
something the code does not, and the new test helpers are typed, which also
drops an unused `sid` argument from every call site.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 11:16:55 -05:00
Sam Dornan
79391961ea fix(security): close netplay authorization gaps found in review
The connect-time identity was cached for the life of the socket, so an
account disabled afterwards kept its access until it disconnected. The
signal relay trusted the room id stored on the session, which a departed
socket still carried, so it could keep injecting offers into the room it
had left, and the game data relay had the same stale room. The room
listing answered for asset-read tokens, though what it discloses is
ROM-scoped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 11:03:28 -05:00
Sam Dornan
dfd7ca9f6a fix(security): hide netplay rooms for roms the caller cannot see
GET /api/netplay/list answered for any game_id a caller passed, including roms
hidden from them, which let the listing confirm that someone was playing a rom
the caller is not allowed to know about.

The room list is now scoped to a rom the caller can see. A hidden rom and a
rom that does not exist both answer with no rooms, so the listing cannot be
used to probe for hidden roms.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 10:42:53 -05:00
Georges-Antoine Assi
86098ef1d9 more changes from bot review 2025-12-07 16:34:22 -05:00
Georges-Antoine Assi
2c93717df6 fix typing 2025-12-07 12:22:46 -05:00
Georges-Antoine Assi
1812b1a3f9 changes from bot reivew 2025-12-07 12:19:13 -05:00
Georges-Antoine Assi
09dbb2e244 use redis to store netplay data 2025-12-07 12:02:35 -05:00
Georges-Antoine Assi
3d4257b805 full wokring sockets 2025-11-21 22:50:39 -05:00
Georges-Antoine Assi
8c769a5fe8 hacks with working netplayu 2025-11-21 19:15:20 -05:00
Georges-Antoine Assi
0967df7789 add typing to stuff 2025-11-21 13:15:25 -05:00
Georges-Antoine Assi
82ca819ab2 start work on netplay endpoints 2025-11-21 11:25:31 -05:00