feat: validating user id from orchestrator#1769
Open
tfheud wants to merge 1 commit intonexus-xyz:mainfrom
Open
feat: validating user id from orchestrator#1769tfheud wants to merge 1 commit intonexus-xyz:mainfrom
tfheud wants to merge 1 commit intonexus-xyz:mainfrom
Conversation
| .save(config_path) | ||
| .map_err(|e| handle_cmd_error!(e, "Failed to save config."))?; | ||
|
|
||
| if !user_id.is_empty() && uuid::Uuid::parse_str(&user_id).is_err() { |
Collaborator
There was a problem hiding this comment.
If this is intended to be a nested if statement, it should be indented. I'm not sure this is important to explicitly check though as orchestrator should always return valid user ids
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.
What has been changed in this block:
User ID validation:
A check has been added to ensure that user_id is not empty and is a valid UUID using uuid::Uuid::parse_str. If the uuid crate is already imported, this does not require any additional dependencies.
If you don't want to use uuid, you can remove the check uuid::Uuid::parse_str(&user_id).is_err() and leave only !user_id.is_empty(), but this is less strict.
Converting wallet_address to lowercase:
wallet_address.to_lowercase() has been added for consistency, as the address is compared in lowercase in other parts of the function.
Existing configuration check:
If the configuration file exists, the code checks that user_id and wallet_address match the values from the orchestrator to prevent overwriting mismatched data.