linux-automation / usbsdmux

USB-SD-Mux Project - Driver and Documentation
GNU Lesser General Public License v2.1
66 stars 19 forks source link

Validate sg device path and descriptor #33

Closed hnez closed 3 years ago

hnez commented 3 years ago

The usbsdmux command and usbsdmux-service do not validate the supplied device path. This is not ideal, especially for the service, as it allows normal users to send a sequence of weird ioctl to any device they want.

This commit adds checks for the device path and USB descriptor values while still allowing the user to override these checks. This fixes #26.

hnez commented 3 years ago

The discovery of USB device descriptor contents by traversing upwards in /sys/devices was deemed not stable enough. An alternative would be the usage of pyudev to do the discovery. But we decided that the list feature is not worth the additional dependency. Closing this for now.