trezor-suite icon indicating copy to clipboard operation
trezor-suite copied to clipboard

[wip] transport rewire

Open mroz22 opened this issue 3 years ago • 2 comments

A prerequisite for #4770. At the moment, there is a couple of painful places in the transport package, once these are addressed, implementing node usb should be a piece of cake since it should work pretty much in the same way like webusb does.

So far heavy WIP with bunch of regressions.

Notes on what might be separated into own commits / PRs:

  • tests in ts
  • debug link support removal?
  • renaming of webusbplugin to webusbtransport
  • ...

resolves #5035 and couple of others related:

  • #5336
  • #5332
  • #5037
  • #4601

mroz22 avatar Oct 10 '22 07:10 mroz22

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] bar@* or ignore all packages with @SocketSecurity ignore-all

socket-security[bot] avatar Oct 12 '22 10:10 socket-security[bot]

Finally managed to get to the point where desktop app works with nodeusb transport and code is structured more or less in a good way. Of course it is still terribly messy and I needed to disable few features (sessions, unacquired devices etc) to make it work for now.

mroz22 avatar Oct 12 '22 10:10 mroz22

@mroz22 I have being trying to debug why when I run this branch in my computer the app sometimes crashes and it is because of LIBUSB_ERROR_ACCESS error form node-usb it looks like a known issue regarding permissions, but I am curious why I was not having that issue before.

DEVICE.LIST init
-> [backend] handshake 0 payload  {"type":"handshake","caller":"FdY","id":0}
<- [backend]: with:  handshake 0   {"success":true} sessions:  {}
result from transport init in DeviceList { success: true, payload: undefined }
@trezor/transport enumerate!
-> [backend] enumerateIntent 1 payload  {"type":"enumerateIntent","caller":"FdY","id":1}
<- [backend]: with:  enumerateIntent 1   {"success":true,"payload":{"sessions":{}}} sessions:  {}
@trezor/transport enumerateIntentResult { success: true, payload: { sessions: {} }, id: 1 }
unexpected error:  initialize error: Error: LIBUSB_ERROR_ACCESS
@trezor/transport enumerateResult {
  success: false,
  error: 'unexpected error',
  message: 'initialize error: Error: LIBUSB_ERROR_ACCESS'
}

karliatto avatar Feb 23 '23 08:02 karliatto

I have being trying to debug why when I run this branch

Cool, thanks for testing. Will think about it, but this could be probably left for "post mvp". In this PR nodeusb is still in debug menu so there will be space for debugging after this is merged. Now I'd focus mainly on possible regressions introduced during refactoring.

mroz22 avatar Feb 27 '23 10:02 mroz22

reacted to most of @szymonlesisz comments and created some separated PR's

#7821 - debug menu related changes, should not depend on this PR, can be based on develop directly #7820 - adding nodeusb transport, depends on this PR

this PR requires rebasing but I don't want to change commit hashes in comments now

mroz22 avatar Mar 12 '23 14:03 mroz22

New and updated dependency changes detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives[^1] Size Publisher
@types/sharedworker 🆕 0.0.84 None +0 282 kB types
[^1]: https://docs.socket.dev

socket-security[bot] avatar Jun 07 '23 14:06 socket-security[bot]