Page MenuHomePhabricator

[keyserver] Validate websocket output
ClosedPublic

Authored by michal on May 9 2023, 1:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 23, 7:04 AM
Unknown Object (File)
Sun, Dec 15, 9:36 PM
Unknown Object (File)
Sun, Dec 15, 9:36 PM
Unknown Object (File)
Sun, Dec 15, 9:36 PM
Unknown Object (File)
Sun, Dec 15, 9:35 PM
Unknown Object (File)
Sun, Dec 15, 9:17 PM
Unknown Object (File)
Fri, Nov 29, 10:10 AM
Unknown Object (File)
Nov 25 2024, 8:47 PM
Subscribers

Details

Summary

Adds validators for server socket messages with tests, and enables output validation in the socket implementation.

Depends on D7714

Test Plan

Check if web and ios app work fine, and there aren't any errors.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

keyserver/src/socket/socket.js
380–392 ↗(On Diff #26241)

If there's no viewer we can't be sure if we want to convert the ids (could be an old client). But this should happen only in case of an error, and none of the error payloads contain ids.

lib/types/socket-types.js
407 ↗(On Diff #26241)

The payload from the responders will be converted already.

michal requested review of this revision.May 9 2023, 1:54 AM
tomek added inline comments.
keyserver/src/socket/socket.js
380–392 ↗(On Diff #26241)

I guess we can still validate the response. There's nothing wrong in doing that.

This revision is now accepted and ready to land.May 10 2023, 1:02 AM
  • Validate also when viewer is null (when error socket message is sent)
  • APIResponseServerSocketMessage can have no payload (for example when calling deviceTokenUpdateResponder which returns void). Updated the socket type and the validator to match this