Conversation
- Add validate_ssid() for WiFi SSID validation (max 32 bytes) - Add validate_connection_name() for VPN/connection names (max 255 bytes) - Add validate_wifi_security() for WPA-PSK (8-63 chars) and WPA-EAP - Add validate_vpn_credentials() with full VPN validation - Add helpers for WireGuard keys, CIDR, IP addresses - Include unit tests for all validation functions
- Validate SSID and credentials in connect() - Validate SSID in forget() - Fail fast with clear error messages before D-Bus calls
- Validate SSID/connection name in get_saved_connection_path() - Applies to both WiFi SSIDs and VPN connection names
- Validate full VPN credentials in connect_vpn() - Validate VPN name in disconnect_vpn() - Validate VPN name in forget_vpn() - Validate VPN name in get_vpn_info() - Prevents invalid data from reaching NetworkManager
- Test invalid inputs are rejected - Test valid inputs are accepted - Verify error types are correct
c012a4c to
1db1964
Compare
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 adds input validation before any D-Bus operations. Clear, descriptive error messages are spewed immediately instead of cryptic D-Bus errors later. This prevents invalid data from reaching NetworkManager and improves the user experience significantly.