Harden pairing and validate Remote song input #26

Merged
nezumi merged 1 commit from security/harden-pairing-and-song-input into dev 2026-11-22 05:21:48 +00:00
Owner

Summary

Fixes three low-severity issues found in a source security review.

  • Room code: now 6 digits generated with SecureRandom; persisted 4-digit codes are replaced on start. Remote input, hint text, mock server and docs updated.
  • Pairing throttle: failed /api/pair attempts are counted per client address (5/min) with a global ceiling (60/min), so one LAN device can no longer block pairing for everyone.
  • Song input from Remotes: videoId must be an 11-character YouTube id, thumbnails are limited to YouTube image hosts, title/channel lengths are bounded, and the queue is capped at 200.

Testing

./gradlew testDebugUnitTest passes; pnpm typecheck passes. Added a test for song sanitizing; the per-host pairing limit has no test yet. Not run on a TV or emulator.

Vi: Mã phòng giờ gồm 6 số khó đoán hơn, giới hạn thử sai theo từng thiết bị và chặn dữ liệu bài hát không hợp lệ từ điện thoại

## Summary Fixes three low-severity issues found in a source security review. - **Room code:** now 6 digits generated with `SecureRandom`; persisted 4-digit codes are replaced on start. Remote input, hint text, mock server and docs updated. - **Pairing throttle:** failed `/api/pair` attempts are counted per client address (5/min) with a global ceiling (60/min), so one LAN device can no longer block pairing for everyone. - **Song input from Remotes:** `videoId` must be an 11-character YouTube id, thumbnails are limited to YouTube image hosts, title/channel lengths are bounded, and the queue is capped at 200. ## Testing `./gradlew testDebugUnitTest` passes; `pnpm typecheck` passes. Added a test for song sanitizing; the per-host pairing limit has no test yet. Not run on a TV or emulator. Vi: Mã phòng giờ gồm 6 số khó đoán hơn, giới hạn thử sai theo từng thiết bị và chặn dữ liệu bài hát không hợp lệ từ điện thoại
Harden pairing and validate Remote song input
All checks were successful
CI / build (pull_request) Successful in 1m54s
52bc0ed463
Room code is now 6 digits from SecureRandom (older 4-digit codes are replaced
on start). Failed pairing attempts are throttled per client address, with a
global ceiling. Songs sent by Remotes must have an 11-character YouTube id,
thumbnails are limited to YouTube image hosts, text lengths are bounded and
the queue is capped at 200 songs.

Vi: Mã phòng giờ gồm 6 số khó đoán hơn, giới hạn thử sai theo từng thiết bị và chặn dữ liệu bài hát không hợp lệ từ điện thoại
nezumi deleted branch security/harden-pairing-and-song-input 2026-11-22 05:21:48 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nezumi/kara-tv-app!26
No description provided.