Git Product home page Git Product logo

hidfox's Introduction

HIDFox

Firefox WebHID API support through webextension native messaging.

Demo

Demo is outdated, the UI is much more polished now.

Security

Consider it dangerous and harmful for now. You can try to use it, still.

Current concerns:

Page has access to the Hid/HidDevice objects

Sensitive information here is protected by private fields (#name) and symbols.

Is this good enough? Maybe all of the sensitive objects should be passed as a closure? Anyway, even injected script should only access non-sensitive information.

For devices, ids hash is used, and this may be used for unique user identification (If user has allowed hid access to the page), but not for system information disclosure

Page may intercept/inject WindowMessageChannel data

Uh oh. Content script should block any AddForwarded calls from the injected script, and should not send any sensitive info (See the first concern).

User error

Some considerations are taken into account, there should be an ability to not remember device access, there is an delay before allowing device access button activates, to prevent misclicks.

In case of device not found - there is no immediate rejection, user should reject device access themselves, so the page may not identify user by querying accessible devices.

Performance

None. The protocol is awful for now, do not expect it to transfer large amounts of data quickly.

Every packet is serialized to json, and has at least 3 hops:

  • Injected → Content (No serialization/deserialization. Message object is passed between 2 isolates)

  • Content → Background (Quick serialization)

  • Background → Native (JSON serialization + JSON deserialization)

Every byte array is serialized as JSON array. At least base64 should be used.

Binary format is not possible, as background<→native communication may only use utf8. Maybe implement base127?

HID:

hid

Hid device:

hid device

Plans

TODO: Switch to popups, once https://bugzilla.mozilla.org/show_bug.cgi?id=1799344 lands

TODO: Use popups when available in case of about:config flag set

TODO: Settings

TODO: Security

TODO: Do not remember transient device ids

TODO: Ability to disable extension by default, whitelisting pages to have HID access.

TODO: Make it possible to support third-party extensions, I.e injection into metamask. Probably requires metamask extension support?

License

Not decided yet, code is not yet completed. For now consider this code source-available, and do not try to use it.

hidfox's People

Contributors

certainlach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.