Skip to content

Commit 27651c4

Browse files
Rob Pitkinchromium-wpt-export-bot
authored andcommitted
bluetooth: Fix missing blocklist check for characteristic in descriptors
Web Bluetooth fails to check the GATT blocklist for a descriptor's parent characteristic during read and write operations. This allows websites to bypass security restrictions and interact with descriptors of protected characteristics. This CL adds checks in `RemoteDescriptorReadValue` and `RemoteDescriptorWriteValue` to ensure that the parent characteristic is also checked against the GATT blocklist before allowing read or write operations on its descriptors. Unit tests are added to verify that reads and writes are blocked when the parent characteristic is blocklisted. Bug: 503912196 Change-Id: If62e10d5ac66ed414aec1a3a4af346133a584374 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7837659 Commit-Queue: Rob Pitkin <robpitkin@chromium.org> Reviewed-by: Matt Reynolds <mattreynolds@chromium.org> Cr-Commit-Position: refs/heads/main@{#1631633}
1 parent cc8f0fb commit 27651c4

1 file changed

Lines changed: 36 additions & 9 deletions

File tree

bluetooth/resources/bluetooth-fake-devices.js

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var blocklist_exclude_reads_characteristic_uuid =
2929
'bad1c9a2-9a5b-4015-8b60-1579bbbf2135';
3030
var request_disconnection_characteristic_uuid =
3131
'01d7d88a-7451-419f-aeb8-d65e7b9277af';
32+
var heart_rate_measurement_uuid = '00002a37-0000-1000-8000-00805f9b34fb';
3233

3334
/* Descriptor UUIDs */
3435
var blocklist_test_descriptor_uuid = 'bad2ddcf-60db-45cd-bef9-fd72b153cf7c';
@@ -610,12 +611,25 @@ async function getBlocklistExcludeWritesCharacteristic() {
610611
* objects.
611612
*/
612613
async function getBlocklistExcludeReadsDescriptor() {
613-
let result = await getBlocklistExcludeWritesCharacteristic();
614-
let descriptor = await result.characteristic.getDescriptor(
615-
blocklist_exclude_reads_descriptor_uuid);
614+
let result = await getBlocklistTestService();
615+
616+
let fake_heart_rate_characteristic =
617+
await result.fake_service.addFakeCharacteristic({
618+
uuid: heart_rate_measurement_uuid,
619+
properties: ['read', 'write'],
620+
});
621+
622+
let fake_descriptor = await fake_heart_rate_characteristic.addFakeDescriptor(
623+
{uuid: blocklist_exclude_reads_descriptor_uuid});
624+
625+
let characteristic = await result.service.getCharacteristic(heart_rate_measurement_uuid);
626+
let descriptor = await characteristic.getDescriptor(blocklist_exclude_reads_descriptor_uuid);
627+
616628
return Object.assign(result, {
629+
characteristic,
630+
fake_characteristic: fake_heart_rate_characteristic,
617631
descriptor,
618-
fake_descriptor: result.fake_blocklist_exclude_reads_descriptor
632+
fake_descriptor
619633
});
620634
}
621635

@@ -641,12 +655,25 @@ async function getBlocklistExcludeReadsDescriptor() {
641655
* objects.
642656
*/
643657
async function getBlocklistExcludeWritesDescriptor() {
644-
let result = await getBlocklistExcludeWritesCharacteristic();
645-
let descriptor = await result.characteristic.getDescriptor(
646-
'gatt.client_characteristic_configuration');
658+
let result = await getBlocklistTestService();
659+
660+
let fake_heart_rate_characteristic =
661+
await result.fake_service.addFakeCharacteristic({
662+
uuid: heart_rate_measurement_uuid,
663+
properties: ['read', 'write'],
664+
});
665+
666+
let fake_descriptor = await fake_heart_rate_characteristic.addFakeDescriptor(
667+
{uuid: 'gatt.client_characteristic_configuration'});
668+
669+
let characteristic = await result.service.getCharacteristic(heart_rate_measurement_uuid);
670+
let descriptor = await characteristic.getDescriptor('gatt.client_characteristic_configuration');
671+
647672
return Object.assign(result, {
648-
descriptor: descriptor,
649-
fake_descriptor: result.fake_blocklist_exclude_writes_descriptor,
673+
characteristic,
674+
fake_characteristic: fake_heart_rate_characteristic,
675+
descriptor,
676+
fake_descriptor
650677
});
651678
}
652679

0 commit comments

Comments
 (0)