Skip to content

feat(nmrs): input validation#173

Merged
cachebag merged 8 commits intomasterfrom
input-validation
Jan 17, 2026
Merged

feat(nmrs): input validation#173
cachebag merged 8 commits intomasterfrom
input-validation

Conversation

@cachebag
Copy link
Owner

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.

@cachebag cachebag self-assigned this Jan 17, 2026
@cachebag cachebag added feature New feature or request nmrs Changes to nmrs refactor Change or improve code labels Jan 17, 2026
- 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
@cachebag cachebag merged commit a031a22 into master Jan 17, 2026
7 checks passed
@cachebag cachebag deleted the input-validation branch January 18, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request nmrs Changes to nmrs refactor Change or improve code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant