Fix(validation): Normalize profile names by trimming whitespace#57
Closed
sameerchore wants to merge 3 commits into
Closed
Fix(validation): Normalize profile names by trimming whitespace#57sameerchore wants to merge 3 commits into
sameerchore wants to merge 3 commits into
Conversation
Signed-off-by: Sameer Chore <sameerchore5@gmail.com>
ec4b590 to
9d740f3
Compare
Signed-off-by: Sameer Chore <sameerchore5@gmail.com>
…argo audit Signed-off-by: Sameer Chore <sameerchore5@gmail.com>
Contributor
Author
|
Hi @stormer78, Could you please take a look at this PR when you get a chance? I believe the changes are in good shape, but I’m happy to make any further updates if needed. If everything looks good from your side, we can proceed for further procedure or updations if required. |
stormer78
added a commit
that referenced
this pull request
May 5, 2026
Folds in @sameerchore's PR #57. `validate_profile_name` now trims leading/trailing whitespace before validating, so `" default "` is treated as `"default"`, and the empty/whitespace check runs *before* the character validation so a whitespace-only input (" ") gets a clear "cannot be empty or contain only whitespace" error instead of the confusing "Invalid profile name ' '" the alphanumeric check used to produce. Adds the three integration tests from the PR: - whitespace_only_profile_name_rejected - padded_default_profile_name_accepted - padded_valid_profile_name_accepted Closes #57. Co-authored-by: Sameer Chore <sameerchore5@gmail.com> Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
stormer78
added a commit
that referenced
this pull request
May 5, 2026
Records the substantive folds from PRs #57 (profile-name validation), #51 (Windows AppData + PathBuf cross-platform paths, closes #47), and #34 (SecuredConfig tagged-variant downgrade defence + intent gate) under v0.2.0's "Post-release deep-review pass". Adds a "Community contributions" subsection summarising each fold with author credit. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
Contributor
|
Thank you @sameerchore — folded into the v0.2.0 release branch as commit ae7fd72 with Closing in favour of #58. |
stormer78
added a commit
that referenced
this pull request
May 5, 2026
Folds in @sameerchore's PR #57. `validate_profile_name` now trims leading/trailing whitespace before validating, so `" default "` is treated as `"default"`, and the empty/whitespace check runs *before* the character validation so a whitespace-only input (" ") gets a clear "cannot be empty or contain only whitespace" error instead of the confusing "Invalid profile name ' '" the alphanumeric check used to produce. Adds the three integration tests from the PR: - whitespace_only_profile_name_rejected - padded_default_profile_name_accepted - padded_valid_profile_name_accepted Closes #57. Co-authored-by: Sameer Chore <sameerchore5@gmail.com> Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
stormer78
added a commit
that referenced
this pull request
May 5, 2026
Records the substantive folds from PRs #57 (profile-name validation), #51 (Windows AppData + PathBuf cross-platform paths, closes #47), and #34 (SecuredConfig tagged-variant downgrade defence + intent gate) under v0.2.0's "Post-release deep-review pass". Adds a "Community contributions" subsection summarising each fold with author credit. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
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.
Fix: Normalize profile name validation by trimming whitespace
Description
What was wrong
The
validate_profile_namefunction inopenvtc-lib/src/config/public_config.rsdid not normalize input before validation:" default "were not recognized as"default", causing unexpected rejections." ") bypassed the empty check (since" ".is_empty()isfalse) and were evaluated by the character validation, leading to inconsistent error messages.What was changed
.trim()before any validation logic runs.Impact
" default "now correctly resolves as"default"."Profile name cannot be empty or contain only whitespace").Advantages
" default ""default"" "(spaces)""(empty)" my-profile ""my-profile"Risk
Note
Minimal — This change only affects edge cases involving leading/trailing whitespace. All previously valid profile names continue to work identically. The only behavioral change is that whitespace-padded inputs are now accepted (after trimming) rather than rejected.
Testing
whitespace_only_profile_name_rejected—" "," ","\t"→ errorpadded_default_profile_name_accepted—" default "," default "→ okpadded_valid_profile_name_accepted—" my-profile "," Profile123 "→ okRun tests with:
cargo test --test profile_validationResult: