Skip to content

fix(nmrs): switch to correct connection validation method#426

Merged
cachebag merged 1 commit into
masterfrom
fix/validate-vpn-name
May 26, 2026
Merged

fix(nmrs): switch to correct connection validation method#426
cachebag merged 1 commit into
masterfrom
fix/validate-vpn-name

Conversation

@cachebag
Copy link
Copy Markdown
Collaborator

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

@cachebag cachebag self-assigned this May 26, 2026
@cachebag cachebag added bug Something isn't working nmrs Changes to nmrs builders Connection builder API and validation labels May 26, 2026
@cachebag cachebag requested a review from Copilot May 26, 2026 19:04
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
@cachebag cachebag force-pushed the fix/validate-vpn-name branch from f1e1a4e to 6377675 Compare May 26, 2026 19:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_connection is documented and parameter-named as SSID-specific, but it now relies on get_saved_connection_path which validates with validate_connection_name (255-byte limit) rather than SSID rules (32-byte limit). This changes behavior for SSID callers (including the public NetworkManager::has_saved_connection/get_saved_connection_path wrappers) 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) reintroducing validate_ssid() in the SSID-specific path so Wi-Fi SSID validation remains enforced while VPN names use validate_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())
}

@cachebag cachebag merged commit d977bf0 into master May 26, 2026
6 checks passed
@cachebag cachebag deleted the fix/validate-vpn-name branch May 26, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working builders Connection builder API and validation nmrs Changes to nmrs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ovpn SSID too long 34bytes (max 32 bytes)

2 participants