fix(nmrs): switch to correct connection validation method#426
Merged
Conversation
This PR switches the saved connection lookup to use `validate_connection_name()` instead of `validate_ssid()`. Using the latter causes VPN profile names longer than 32-bytes to pass through. Fixes #425
f1e1a4e to
6377675
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes saved-connection lookups for VPN profiles by validating against connection-name rules (instead of Wi-Fi SSID rules), preventing legitimate VPN names >32 bytes from being rejected.
Changes:
- Replace SSID-based validation in saved connection lookup with
validate_connection_name(). - Refactor early-return validation into a small helper (
should_skip_lookup). - Add unit tests to ensure long VPN names are permitted and blank names are skipped.
Comments suppressed due to low confidence (1)
nmrs/src/core/connection_settings.rs:82
has_saved_connectionis documented and parameter-named as SSID-specific, but it now relies onget_saved_connection_pathwhich validates withvalidate_connection_name(255-byte limit) rather than SSID rules (32-byte limit). This changes behavior for SSID callers (including the publicNetworkManager::has_saved_connection/get_saved_connection_pathwrappers) by no longer rejecting overlong/invalid SSIDs. Consider either (a) renaming/updating the docs/parameter to reflect a generic “connection id/name” lookup, or (b) reintroducingvalidate_ssid()in the SSID-specific path so Wi-Fi SSID validation remains enforced while VPN names usevalidate_connection_name().
/// Checks whether a saved connection exists for the given SSID.
pub(crate) async fn has_saved_connection(conn: &Connection, ssid: &str) -> Result<bool> {
get_saved_connection_path(conn, ssid)
.await
.map(|p| p.is_some())
}
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.
This PR switches the saved connection lookup to use
validate_connection_name()instead ofvalidate_ssid(). Using the latter causes VPN profile names longer than 32-bytes to pass through.Fixes #425