Asset request/response pipeline #3

Closed
opened 2026-03-16 06:58:10 +00:00 by kit · 0 comments
Owner

Implement the asset delivery system so the client can request and receive raw Source engine files from the server.

Server side (native module)

  • Handle asset_request JSON messages from clients
  • Read requested file via IFileSystem::Open() (already have the interface pointer)
  • Validate/sanitize paths — only serve files under game content paths, reject .. traversal
  • Send file contents as binary WebSocket frames with MSG_ASSET_DATA (0x10) header: u8 type | u16 path_len | utf8 path | raw bytes

Client side

  • When a new model_id appears in a snapshot, check IndexedDB cache first
  • If not cached, send asset_request to server
  • Store received raw data in IndexedDB keyed by path
  • This is the foundation for Phase 2 (BSP maps) and Phase 3 (MDL models)

Security considerations

  • Path validation is critical — the module has access to the full engine filesystem
  • Whitelist allowed file extensions (.mdl, .vtx, .vvd, .vtf, .vmt, .bsp)
  • Reject any path containing .. or starting with /
Implement the asset delivery system so the client can request and receive raw Source engine files from the server. ### Server side (native module) - Handle `asset_request` JSON messages from clients - Read requested file via `IFileSystem::Open()` (already have the interface pointer) - Validate/sanitize paths — only serve files under game content paths, reject `..` traversal - Send file contents as binary WebSocket frames with `MSG_ASSET_DATA` (0x10) header: `u8 type | u16 path_len | utf8 path | raw bytes` ### Client side - When a new `model_id` appears in a snapshot, check IndexedDB cache first - If not cached, send `asset_request` to server - Store received raw data in IndexedDB keyed by path - This is the foundation for Phase 2 (BSP maps) and Phase 3 (MDL models) ### Security considerations - Path validation is critical — the module has access to the full engine filesystem - Whitelist allowed file extensions (`.mdl`, `.vtx`, `.vvd`, `.vtf`, `.vmt`, `.bsp`) - Reject any path containing `..` or starting with `/`
kit closed this issue 2026-03-16 08:35:25 +00:00
Sign in to join this conversation.
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
kit/gmod-web-stream#3
No description provided.