Files
KoalaSync/shared
MacBook f7829bbebb security: harden server relay + documentation audit
Server Security (S-1 through S-8):
- S-1: Type-check and clamp peerId, protocolVersion, password
- S-2: Validate numeric/boolean/enum fields in relay peerData
- S-3: Construct explicit relay payload (stop spreading raw data)
- S-4: Type-check targetId and actionTimestamp in EVENT_ACK
- S-5: Restrict room IDs to [a-zA-Z0-9-] only
- S-7: Add eventCounts periodic cleanup alongside connectionCounts
- S-8: Guard version parsing against NaN bypass

Documentation (P-1, R-1 through R-6):
- P-1: Fix PRIVACY.md typo, document all in-memory data maps
- R-1/R-5: Fix stale sync-constants.bat references in shared/
- R-2: Fix stale lastTargetState ref in ARCHITECTURE.md
- R-3: Extension README title reflects cross-browser support
- R-6: Document content injection markers in scripts/README.md
2026-05-04 05:19:18 +02:00
..

KoalaSync Shared Constants

This directory contains constants and protocol definitions used by both the extension and the server.

Syncing with the Extension

Important

Every time this file is modified, you must run node scripts/build-extension.js to keep the extension's copy up to date.

Because Chrome Extensions cannot load files outside their root directory, constants.js must be copied to extension/shared/constants.js whenever it is modified.

Security & Versioning Constants

  • OFFICIAL_SERVER_TOKEN: A 32-byte hex token required to connect to the official relay server.
  • APP_VERSION: The current version of the extension. Used by the server to enforce minimum version requirements (Revocation). This must always be in sync with manifest.json.
  • OFFICIAL_SERVER_URL: The default endpoint for the official KoalaSync relay.
  • ROOM_DATA: Server response with current room state (peers).
  • PLAY: Sync command to start playback.
  • PAUSE: Sync command to pause playback.
  • SEEK: Sync command to change the current time.
  • PEER_STATUS: Heartbeat or join/leave notification for peers.
  • FORCE_SYNC_PREPARE: Phase 1 of Force Sync (Pause & Seek).
  • FORCE_SYNC_ACK: Peer confirmation of Phase 1 readiness.
  • FORCE_SYNC_EXECUTE: Phase 2 of Force Sync (Start Playback).
  • ERROR: Generic error message from the server.