Two Google engineers have introduced a new API called WebUSB to the World Wide Web Consortium’s Incubator Community Group (W3C WICG) that would allow USB devices to connect to the Web safely.
The API isn’t meant for USB flash drives, but other peripherals like keyboards or various Internet of Things
crap gadgets. The process isn’t meant for some sort of advanced file transfer, either; it’s to safely connect hardware to the Web without the need for a dedicated platform.
In their proposal, the Googlers explain their aim:
The engineers also touch on security. A USB device and a computer trust one another by default, so there has to be a safeguard for your data. To help, the engineers plan to invent a type of Cross-Origin Resource Sharing (CORS) which prevents Webpages from requesting data from anything other than the page you’re visiting.
That means a Webpage couldn’t ever use the USB device to access your computer, or any files that it or the USB device itself may hold.
Luckily, the API was also designed to be backwards compatible, which may allow developers to breathe new life into old peripherals. If you want to check out the full WebUSB codebase, it’s being hosted on GitHub.