Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socketlogger can get overwhelmed - need to sanitize the data #36

Open
ddfridley opened this issue Mar 30, 2023 · 0 comments
Open

socketlogger can get overwhelmed - need to sanitize the data #36

ddfridley opened this issue Mar 30, 2023 · 0 comments

Comments

@ddfridley
Copy link
Contributor

In the undebate repo, ending.jsx this line:

    logger.trace('ending.onUserUpload', props)

will cause the socket.io websocket to disconnect after several seconds.
The disconnect will cause the node-socketio-stream in create-participant.js to close, and close the socket.io stream. Note: if the socket.io-stream didn't force a close of the socket.io socket - it will reconnect.
But the end result was that uploads of recorded video would get aborted a few seconds after they are started and it was really hard to trace down.

The problem was that in ending.jsx, the props includes ccState which includes the recorded video blobs. If you console.info props, its' fine and it shows the blob size. But (I presume) that socket.io is trying to encode and transfer the video blobs (they are megabytes).

The proposed solution here is that socketlogger on the client side, should traverse through the arguments being logged, and convert Blobs and other large things into strings that just indicate the length. (similar to how it looks with console.info). For example Blob {size:1743098, type: 'video/webm;codecs=vp9,opus'}

OR there might be an option to tell socket.io to do this. But it needs to be investigated, and must only apply to the socketlogger api calls and not other api calls.

The work around is to not log props in this case, but it's hard to prevent this type of error from coming up again.

Please build a jest test for this. It's easy to create tests of the socket-apis that have both the client and server side code and it makes it a lot easier to write and test the code for a deep feature like this - see undebate-ssp /app/socket-apis/tests/send-moderator-invite.js for an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant