Conversation
Introduced `validate_username` helper function in `src/app/fprint.rs` to enforce strict validation (alphanumeric, -, _, ., max 255 chars) on usernames before passing them to privileged `fprintd` D-Bus methods. This mitigates potential injection risks or malformed data issues. Applied validation to: - `list_enrolled_fingers_dbus` - `delete_fingerprint_dbus` - `delete_fingers` - `clear_all_fingers_dbus` - `enroll_fingerprint_process` Added unit tests to verify validation logic.
This commit introduces a new `tests` module in `src/app/error.rs` to verify the `From<zbus::Error>` implementation for `AppError`. It includes: - A helper function `create_method_error` to construct `zbus::Error::MethodError` with a dummy D-Bus message. - Test cases for all mapped `net.reactivated.Fprint.Error.*` strings. - Test cases for unknown errors and non-MethodError variants to ensure correct fallback to `AppError::Unknown`. This improves test coverage for critical error handling logic.
test: verify zbus::Error to AppError conversion
… cloning Refactor `enroll_fingerprint_process` to accept references (`&zbus::zvariant::OwnedObjectPath`, `&str`) instead of owned types for `path`, `finger_name`, and `username`. This eliminates the need to clone `String` and `OwnedObjectPath` data on every iteration of the enrollment subscription loop in `AppModel`. * Modified `src/app/fprint.rs`: Updated `enroll_fingerprint_process` signature. * Modified `src/app/mod.rs`: Updated subscription logic to pass references.
…529251015568 ⚡ Async Config Loading Optimization
…333057639684485 ⚡ Optimize enrollment subscription by avoiding unnecessary string cloning
…4448153143460 🔒 Security Fix: Validate username in D-Bus calls
jotuel
added a commit
that referenced
this pull request
Feb 25, 2026
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.
Slight performance increase from not copying but using reference. Increase test coverage. Username is validated and config loaded asynchronously.