Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e6c031a
refactor(addon): use exact frame bridge endpoints
K4zoku Sep 12, 2026
8f3edef
fix(addon): aggregate frame state in background
K4zoku Sep 13, 2026
8c8306b
fix(addon): harden frame authority lifetimes
K4zoku Sep 13, 2026
ea91da4
fix(addon): partition opaque frame persistence
K4zoku Sep 13, 2026
d69df43
fix(addon): gate activation policy on settings snapshot
K4zoku Sep 13, 2026
3c64ebb
fix(addon): isolate opaque permission events
K4zoku Sep 13, 2026
8058af5
fix(addon): scope permission events by partition
K4zoku Sep 13, 2026
4b8b362
feat(addon): expose persistent settings targets
K4zoku Sep 13, 2026
dcfe8ea
test(addon): cover opaque target isolation
K4zoku Sep 13, 2026
1614bc1
fix(addon): preserve opaque sibling sessions
K4zoku Sep 13, 2026
8d764fb
fix(addon): stabilize settings listeners and revoke scopes
K4zoku Sep 13, 2026
970c218
test(addon): cover partition-aware popup revoke
K4zoku Sep 13, 2026
c3a1a35
fix(addon): make settings listeners disposable
K4zoku Sep 13, 2026
25dcf7b
fix(addon): use canonical opaque persistence keys
K4zoku Sep 13, 2026
dfc6669
fix(addon): resync MAIN after scope changes
K4zoku Sep 13, 2026
1c88bf9
fix(addon): derive opaque target labels in popup
K4zoku Sep 13, 2026
104d30d
fix(addon): bind scope loads to captured identities
K4zoku Sep 13, 2026
c3765f6
fix(addon): enforce exact document policy authority
K4zoku Sep 14, 2026
fb650e8
fix(addon): clean picker state on endpoint retirement
K4zoku Sep 14, 2026
4ef4341
fix(addon): restore per-origin data-plane status
K4zoku Sep 14, 2026
069462f
test(e2e): isolate sequential consent scenarios
K4zoku Sep 14, 2026
3353c2e
fix(addon): receive ack response
K4zoku Sep 14, 2026
a89a5b9
refactor(mock): expose uhid backend as library
K4zoku Sep 15, 2026
285182e
fix(daemon): disambiguate uhid sibling open identities
K4zoku Sep 15, 2026
f26cb56
test(e2e): match paired vendor by vid/pid not list position
K4zoku Sep 15, 2026
78a7d57
fix(daemon): stub descriptor identity check off Linux
K4zoku Sep 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ Two layers, always-on like Chromium:
1. Device-level (`hid.rs`): FIDO usage page 0xF1D0 + per-product security-key list (Chromium `kStaticEntries`); hidden from enumeration.
2. Report-level (`blocklist.rs`/`report_blocking.rs`): WICG `blocklist.txt` entry-for-entry (FIDO, GD Mouse/Keyboard/Keypad/SystemControl, Jabra, OnlyKey). Any-match per (report_id, type) over a report→collection map where each report carries every ancestor collection's usage (a Mouse report in a Physical child IS blocked); plus hardcoded always-protected usages (page 0x07; GD Pointer/Mouse/Keyboard/Keypad; GD SystemControl 0x80-0x8f, 0xa0-0xb6); plus an undocumented-report-ID fallback (blocks when the device has an always-protected top-level). Unparseable/empty descriptors fail closed: the device is hidden from enumeration and `open()` refuses it, since there is no collection tree to classify reports against (2026-08-20 audit fix; the `dump` subcommand still lists it with the parse error). Input dropped at the reader; output/feature rejected; sends pre-checked like Chromium's `HidConnection::Write` / `GetFeatureReport` / `SendFeatureReport` gates (a report type the descriptor does not declare, `max_*_report_size() == 0`, is rejected). Blocked reports pruned from page-visible `collections` (`prune_device_info`); all-empty devices hidden. SayoDevice config uses distinct report IDs, so only its keyboard report 1 is blocked. Keep fixtures off Mouse/Keyboard/Keypad usages if they must receive reports.

### Device identity (2026-09-16)

The daemon's `device_id` (u32 FNV-1a) is the hash of a per-logical-interface identity string. On Linux that string is the canonical sysfs path of the HID interface; since every interface of a real USB or Bluetooth device canonicalizes to its own stable parent (`.../1-7:1.2`), real hardware needs nothing else. UHID is special: all virtual devices share one parent (`/sys/devices/virtual/misc/uhid`) and the hid device directory name is `bus:vid:pid.instance`, where the instance suffix is a kernel-wide counter reassigned at every device creation. Hashing the full path would change the id at every mock reconnect, while stripping the suffix (the previous behavior) collapsed concurrent sibling interfaces that share bus:vid:pid into one ambiguous id, so `open(device_id)` could pick the wrong hidraw node (observed with two sayo-style UHID devices at hidraw7/hidraw8). The uhid identity therefore keeps the stable `bus:vid:pid` base and mixes in the raw report descriptor (`crates/webhid-daemon/src/hid.rs`, `identity_string`): a recreated virtual device keeps its descriptor and its id (hotplug continuity and persisted grants survive), siblings with different descriptors get different ids, and siblings sharing every observable attribute are indistinguishable and merge into one identity (deduped at enumeration). Invariant: every enumerated logical HID interface has a unique device_id, and `open(device_id)` resolves to that exact interface; genuine 32-bit hash collisions still fail closed (hidden at enumeration, refused at open). Compat: persisted device ids for UHID devices from before the fix no longer match; affected origins must re-pair those devices once. Real USB/Bluetooth hardware ids are unchanged. Regression tests: pure identity tests in `crates/webhid-daemon/src/tests/hid.rs` and real-device tests in `crates/webhid-daemon/src/tests/uhid_siblings.rs` (require `/dev/uhid` access; the mock's protocol layer is a lib target since this change).

### Consent model (2026-08-06)

A page cannot grant itself a device or see the full inventory. `pairDevice`/`recordGrantGroup`/`getGrantGroups`/`getAllPairedDevices`/`revokeDevice`/`getDeviceCache`/`getDeviceInfo`/`showPicker`/`pickerResult` are blocked from page ports (`PAGE_BLOCKED_ACTIONS`, 403). Page `enumerate` is rewritten to `enumeratePaired`; the background filters the daemon inventory by the requesting origin's stored grants. Chooser and extension pages call unmodified `enumerate` for chooser data. Pairing runs in the bridge after chooser selection (`grantSelectedDevices`); `pickerResult` is accepted only from the extension picker page. Devices granted together form a grant group (IndexedDB `grantGroups`); revoking any member cascades to the group and closes that origin's daemon sessions.
Expand Down
17 changes: 15 additions & 2 deletions addon/js/background/content-ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
}
return reached
}

webhid.export('content-ports', { registerContentPort, postToContentPorts })
/**
* Sends one message to a registered exact endpoint.
* @param {object} port
* @param {object} message
* @returns {void}
*/
function postToContentPort(port, message) {
if (!ports.has(port)) return
try {
port.postMessage(message)
} catch {
ports.delete(port)
}
}
webhid.export('content-ports', { registerContentPort, postToContentPorts, postToContentPort })
})()
8 changes: 0 additions & 8 deletions addon/js/background/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,6 @@
else shadowArms.set(key, { count: existing.count - 1, at: existing.at })
})

/**
* Hides page actions from every open tab.
* @returns {void}
*/
function hidePageActions() {
pageActionVisibility.setHidden(true).catch((e) => logger.debug('pageAction.hide failed', e))
}

browser.storage.onChanged.addListener((changes, area) => {
if (area !== 'local') return
let hasSiteChange = false
Expand Down
Loading
Loading