OpenWPM icon indicating copy to clipboard operation
OpenWPM copied to clipboard

Add support for logging websocket traffic after connection is established

Open ed-w-lee opened this issue 6 years ago • 5 comments

Hi all!

We're a group of students who are trying to use OpenWPM. One thing we would like is to log websocket sends and receives into the database, as well as the already existing HTTP requests. Would you all happen to have any ideas on where to get started on doing that? Or, since it likely has to do with modifying the extension / instrumentation, any ideas on who to ask in regards to creating extensions that can hook into websocket sends and receives? We tried looking in the Mozilla web docs, but only really found tips on using websockets, not tracking them.

Thanks!

ed-w-lee avatar Nov 20 '19 05:11 ed-w-lee

Hey @ed-w-lee , consider having a look at the WebExtension API for webRequests
I'm not an expert on this but their first line

Add event listeners for the various stages of making an HTTP request, which includes websocket requests on ws:// and wss://

makes it seem like you might find what you need here :)

vringar avatar Nov 20 '19 09:11 vringar

Are you sure that we don't already have support for logging web socket requests? The webRequest listener is already configured to log websocket requests. @ed-w-lee

englehardt avatar Nov 21 '19 23:11 englehardt

Got it, I think we did see that but don't think it does everything we want it to. I think that the initial request to the websocket was logged with the 101 response, but not the messages being sent and received after the connection is established. Or if they are, we're not entirely sure where such events would be located in the resulting database, as they aren't in http_responses as far as we can tell.

ed-w-lee avatar Nov 23 '19 19:11 ed-w-lee

Hey, sorry for taking so long to get back to you on this. I think would think they should show up in the http_requests and http_responses as well. Do you have the time and interest to create a test case to show us this is broken? Because with this test case I could then go off to try and fix this.

vringar avatar Dec 03 '19 11:12 vringar

At this point I think that we would need to register different callback handlers to catch the WebSockets traffic (I might be very wrong on this though)

vringar avatar Dec 13 '19 18:12 vringar