Repository navigation
espressif: refuse peer access to NO_ACCESS characteristics - #11558
Merged
Merged
Conversation
NimBLE's READ and WRITE flags both declare a characteristic property and allow the access, so a characteristic declared READ or WRITE with a NO_ACCESS permission was fully readable or writable by a peer. Refuse those reads and writes in the access callback, as nordic and zephyr-cp do. Reads with no connection still succeed, so notifications that NimBLE builds from the stored value still go out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Diagnosis and code by Claude, reviewed by @dhalbert.
Bug
READwithread_perm=Attribute.NO_ACCESS, and write one declaredWRITEwithwrite_perm=Attribute.NO_ACCESS.BLE_GATT_CHR_F_READandBLE_GATT_CHR_F_WRITEflags both declare the property and allow the access.NO_ACCESSwithout declaring the matching property, such asStreamIninadafruit_ble, were not affected.Fix
bleio_characteristic_access_cb()now returnsBLE_ATT_ERR_READ_NOT_PERMITTEDorBLE_ATT_ERR_WRITE_NOT_PERMITTEDforNO_ACCESS.Testing
Metro ESP32-S3 with this PR as peripheral:
NO_ACCESScharacteristicsread not permitted,write not permittedfixed_lengthREAD+NOTIFYcharacteristic withNO_ACCESSread permissionread; read refused with Read Not Permitted; notifications receivedble_uart_echo_test.py/ble_uart_echo_client.pyfrom the BLE library examples