Page MenuHomePhabricator

[keyserver] Validate websocket output
ClosedPublic

Authored by michal on May 9 2023, 1:36 AM.
Tags
None
Referenced Files
F3368221: D7749.diff
Mon, Nov 25, 6:45 PM
Unknown Object (File)
Wed, Nov 6, 10:12 PM
Unknown Object (File)
Mon, Oct 28, 8:38 AM
Unknown Object (File)
Oct 25 2024, 2:19 PM
Unknown Object (File)
Oct 17 2024, 6:08 AM
Unknown Object (File)
Oct 13 2024, 6:16 PM
Unknown Object (File)
Oct 8 2024, 12:41 PM
Unknown Object (File)
Sep 28 2024, 3:09 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
No Lint Coverage
Unit
No Test Coverage

Event Timeline

keyserver/src/socket/socket.js
380–392

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

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

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