fix(ble): resolve two Phase 3 audit findings

1. CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=y removed. The default GAP
   Device Name write permission is plain BT_GATT_PERM_WRITE — no
   bonding required (Zephyr gap_svc.c:158). Any connected peer
   (bonded or not) could rename the device. Worse, a GAP write
   updates bt_get_name() but NOT prefs.node_name, so the advertised
   name wouldn't track the renamed value. Rename now flows
   exclusively through CMD_SET_ADVERT_NAME, which is NUS-protected
   (AUTHEN required) and properly propagates via
   zephcore_ble_update_name() to prefs + GATT + adv data.

2. CONFIG_BT_DIS_FW_REV_STR synced from "1.13.0" to "v1.15.1-zephyr"
   to match CompanionMesh.cpp CMD_DEVICE_QUERY's version string.
   Comment added requiring the two to stay in sync.
This commit is contained in:
liquidraver
2026-05-20 16:00:17 +02:00
parent 0ba2721b40
commit 65311f0ea9
+13 -2
View File
@@ -73,7 +73,15 @@ CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="MeshCore"
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_MAX=29
CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=y
# GAP Device Name is read-only over BLE. Renames happen via the
# NUS-protected CMD_SET_ADVERT_NAME command, which updates prefs.node_name,
# calls bt_set_name(), and triggers an adv-data rebuild (see
# zephcore_ble_update_name in ZephyrBLE.cpp). Allowing GAP writes would
# (a) expose an unbonded-peer rename surface (default perm is plain WRITE
# unless WRITABLE_AUTHEN is also set), and (b) create two sources of
# truth — the GAP write updates bt_get_name() but not prefs.node_name,
# so the advertised name wouldn't track the GAP-written name.
# CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=y
CONFIG_BT_DEVICE_APPEARANCE=0
CONFIG_BT_MAX_CONN=1
@@ -140,7 +148,10 @@ CONFIG_BT_DIS_MANUF_NAME_STR="ZephCore"
CONFIG_BT_DIS_MODEL_NUMBER=y
CONFIG_BT_DIS_MODEL_NUMBER_STR="ZephCore"
CONFIG_BT_DIS_FW_REV=y
CONFIG_BT_DIS_FW_REV_STR="1.13.0"
# Keep in sync with the version string in CompanionMesh.cpp CMD_DEVICE_QUERY
# response (the v1.15.1-zephyr literal). Phones that read DIS and phones
# that query CMD_DEVICE_QUERY should see the same version.
CONFIG_BT_DIS_FW_REV_STR="v1.15.1-zephyr"
CONFIG_BT_DIS_SW_REV=y
CONFIG_BT_DIS_SW_REV_STR="Zephyr"
CONFIG_BT_DIS_PNP=n