Skip to content

Commit 6ad4b4e

Browse files
authored
Merge pull request #1593 from UltimateHackingKeyboard/disable_insecure_ble
Don't allow disabling bluetooth security.
2 parents 4236168 + e72f2d9 commit 6ad4b4e

5 files changed

Lines changed: 2 additions & 19 deletions

File tree

device/src/bt_conn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ static void scheduleBtFlow(struct bt_conn *conn, bt_flow_t action, connection_id
838838
static void securityChanged(struct bt_conn *conn, bt_security_t level, enum bt_security_err err) {
839839
BT_TRACE_AND_ASSERT("bc3");
840840
// In case of failure, disconnect
841-
if (err || (level < BT_SECURITY_L4 && !Cfg.Bt_AllowUnsecuredConnections)) {
841+
if (err || level < BT_SECURITY_L4) {
842842
LOG_WRN("Bt security failed: %s, level %u, err %d, disconnecting", GetPeerStringByConn(conn), level, err);
843843

844844
struct bt_conn_info info;

doc-dev/reference-manual.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,6 @@ COMMAND = set emergencyKey KEYID
317317
COMMAND = validateMacros
318318
COMMAND = resetConfiguration
319319
COMMAND = set leds.alwaysOn BOOL
320-
COMMAND = set bluetooth.allowUnsecuredConnections BOOL
321320
COMMAND = set bluetooth.peripheralConnectionCount INT
322321
COMMAND = set bluetooth.minAdvertisingDelay INT
323322
COMMAND = set bluetooth.directedAdvertisingAllowed BOOL
@@ -365,6 +364,7 @@ COMMAND = setCompensateDiagonalSpeed {0|1}
365364
COMMAND = setDebounceDelay <time in ms, at most 250 (INT)>
366365
COMMAND = setKeystrokeDelay <time in ms, at most 65535 (INT)>
367366
COMMAND = setEmergencyKey KEYID
367+
COMMAND = set bluetooth.allowUnsecuredConnections BOOL
368368
```
369369

370370
### Uncategorized commands

right/src/config_manager.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ const config_t DefaultCfg = (config_t){
278278
.I2cBaudRate = I2C_MAIN_BUS_NORMAL_BAUD_RATE,
279279
#endif
280280
.Bt_Enabled = true,
281-
.Bt_AllowUnsecuredConnections = false,
282281
.Bt_MaxPeripheralConnections = 3,
283282
.Bt_MinAdvertisingDelay = 250,
284283
.Bt_AlwaysAdvertiseHid = true,

right/src/config_manager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
key_state_t* EmergencyKey;
9696

9797
// bluetooth
98-
bool Bt_AllowUnsecuredConnections;
9998
bool Bt_DirectedAdvertisingAllowed;
10099
bool Bt_Enabled;
101100
bool Bt_AlwaysAdvertiseHid;

right/src/macros/set_command.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -360,16 +360,6 @@ static macro_variable_t secondaryRoles(parser_context_t* ctx, set_command_action
360360
return noneVar();
361361
}
362362

363-
static macro_variable_t allowUnsecuredConnections(parser_context_t* ctx, set_command_action_t action)
364-
{
365-
ASSIGN_BOOL(Cfg.Bt_AllowUnsecuredConnections);
366-
if (Cfg.Bt_AllowUnsecuredConnections) {
367-
Macros_PrintfWithPos(ctx, "Warning: insecure connections were allowed. This may allow eavesdropping on your keyboard input!");
368-
}
369-
370-
return noneVar();
371-
}
372-
373363
static macro_variable_t bluetooth(parser_context_t* ctx, set_command_action_t action)
374364
{
375365
if (ConsumeToken(ctx, "enabled")) {
@@ -378,8 +368,6 @@ static macro_variable_t bluetooth(parser_context_t* ctx, set_command_action_t ac
378368
#if DEVICE_IS_UHK80_RIGHT
379369
Bt_SetEnabled(newBtEnabled);
380370
#endif
381-
} else if (ConsumeToken(ctx, "allowUnsecuredConnections")) {
382-
return allowUnsecuredConnections(ctx, action);
383371
} else if (ConsumeToken(ctx, "peripheralConnectionCount")) {
384372
#ifdef __ZEPHYR__
385373
DEFINE_INT_LIMITS(1, PERIPHERAL_CONNECTION_COUNT);
@@ -1099,9 +1087,6 @@ static macro_variable_t root(parser_context_t* ctx, set_command_action_t action)
10991087
DEFINE_INT_LIMITS(0, 65535);
11001088
ASSIGN_INT(Cfg.AutoShiftDelay);
11011089
}
1102-
else if (ConsumeToken(ctx, "allowUnsecuredConnections")) {
1103-
return allowUnsecuredConnections(ctx, action);
1104-
}
11051090
else if (ConsumeToken(ctx, "uiStyle")) {
11061091
return uiStyle(ctx, action);
11071092
}

0 commit comments

Comments
 (0)