Skip to content

feat(#215): validate bluetooth address in populate_bluez_info & BluetoothIdentity::new#246

Merged
cachebag merged 4 commits intocachebag:masterfrom
pluiee:pluie/bluetooth-validate
Feb 16, 2026
Merged

feat(#215): validate bluetooth address in populate_bluez_info & BluetoothIdentity::new#246
cachebag merged 4 commits intocachebag:masterfrom
pluiee:pluie/bluetooth-validate

Conversation

@pluiee
Copy link
Contributor

@pluiee pluiee commented Feb 14, 2026

Resolves #215 by implementing validate_bluetooth_address and applying it within populate_bluez_info and BluetoothIdentity::new. Note that BluetoothDevice::new is out of scope since its input comes from populate_bluez_info, assuring the validity.

Copy link
Owner

@cachebag cachebag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise. Thank you!

///
/// # Errors
/// Returns `ConnectionError::InvalidAddress` if the Bluetooth address is invalid.
pub fn validate_bluetooth_address(bdaddr: &str) -> Result<(), ConnectionError> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's best we split and validate segments (I.e. a Vec of &str's for parts and then match on length)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified the impl to check on each segment after splitting.

@cachebag cachebag added nmrs Changes attribute to nmrs refactor Change or improve code labels Feb 15, 2026
@pluiee pluiee force-pushed the pluie/bluetooth-validate branch from 9e01496 to 3b25849 Compare February 16, 2026 08:08
@pluiee
Copy link
Contributor Author

pluiee commented Feb 16, 2026

I rebased after adding a commit to align with the updated master, but there seems to be a minor ci problem.

@pluiee pluiee requested a review from cachebag February 16, 2026 08:25
Copy link
Owner

@cachebag cachebag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank! Don't worry about CI I'm breaking things

@cachebag cachebag merged commit c012121 into cachebag:master Feb 16, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nmrs Changes attribute to nmrs refactor Change or improve code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Add validation for Bluetooth MAC address format

2 participants

Comments