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, Apr 15, 3:39 PM
Unknown Object (File)
Fri, Apr 12, 6:32 PM
Unknown Object (File)
Wed, Apr 10, 8:14 AM
Unknown Object (File)
Fri, Apr 5, 4:59 AM
Unknown Object (File)
Fri, Apr 5, 4:59 AM
Unknown Object (File)
Fri, Apr 5, 4:59 AM
Unknown Object (File)
Fri, Apr 5, 4:58 AM
Unknown Object (File)
Fri, Apr 5, 4:38 AM
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