Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: validate display name on account creation #4994

Merged
merged 1 commit into from
Mar 28, 2024
Merged

Conversation

mprakhov
Copy link
Contributor

Check that the display name was set according to the requirements

Closes # status-im/status-desktop#14128

@mprakhov
Copy link
Contributor Author

@igor-sirotin you are the owner of an account with .eth suffix - could you please check that these changes will not break login and restoring acc by a seed phrase for you?

@status-im-auto
Copy link
Member

status-im-auto commented Mar 27, 2024

Jenkins Builds

Click to see older builds (15)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 97e32a5 #1 2024-03-27 11:33:35 ~56 sec tests 📄log
✔️ 97e32a5 #1 2024-03-27 11:37:08 ~4 min linux 📦zip
✔️ 97e32a5 #1 2024-03-27 11:37:48 ~5 min ios 📦zip
✔️ 97e32a5 #1 2024-03-27 11:38:14 ~5 min android 📦aar
49795ea #2 2024-03-27 11:50:28 ~14 sec linux 📄log
49795ea #2 2024-03-27 11:50:34 ~19 sec android 📄log
✖️ 49795ea #2 2024-03-27 11:51:20 ~1 min tests 📄log
49795ea #2 2024-03-27 11:51:25 ~1 min ios 📄log
✖️ 6b05eb8 #3 2024-03-27 12:13:00 ~45 sec tests 📄log
✔️ 6b05eb8 #3 2024-03-27 12:14:00 ~1 min linux 📦zip
✔️ 6b05eb8 #3 2024-03-27 12:17:31 ~5 min android 📦aar
✔️ 6b05eb8 #3 2024-03-27 12:20:46 ~8 min ios 📦zip
✔️ 3ad8f76 #4 2024-03-27 12:18:59 ~1 min linux 📦zip
✔️ 3ad8f76 #4 2024-03-27 12:19:58 ~2 min android 📦aar
✔️ 3ad8f76 #4 2024-03-27 12:24:33 ~3 min ios 📦zip
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ d4a37a7 #5 2024-03-27 15:56:24 ~2 min android 📦aar
✔️ d4a37a7 #5 2024-03-27 15:57:18 ~3 min ios 📦zip
✔️ d4a37a7 #5 2024-03-27 15:57:27 ~3 min linux 📦zip
✔️ d4a37a7 #5 2024-03-27 16:35:13 ~41 min tests 📄log
✔️ 835adce #6 2024-03-28 15:15:01 ~1 min linux 📦zip
✔️ 835adce #6 2024-03-28 15:15:38 ~2 min android 📦aar
✔️ 835adce #6 2024-03-28 15:16:19 ~3 min ios 📦zip
✔️ 835adce #6 2024-03-28 15:56:08 ~43 min tests 📄log

@@ -74,6 +76,10 @@ func ValidateAccountCreationRequest(c CreateAccount) error {
return ErrCreateAccountInvalidDisplayName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed, I suppose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need it as it will point to a specific error in a specific case. In this example it will tell, that create account has an error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate tells only why validation was failed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the if len(c.DisplayName) == 0 but wasn't able to reach this line in code review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValidateDisplayName all us to have an empty name, but for account creation it is restricted

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Then maybe we could parameterize ValidateDisplayName. Not a big deal though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's parametrisation introduced here: #4980

protocol/requests/create_account.go Outdated Show resolved Hide resolved
Copy link
Contributor

@igor-sirotin igor-sirotin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned, the fix doesn't seem to apply for status-desktop, because CreateAccountAndLogin endpoint is not yet used by it (there's a PR: status-im/status-desktop#14139).

Currently this code is used in desktop to create account and store a new account:

https://github.com/status-im/status-desktop/blob/fae7e82e0a530d3fde50540bf0133032227a1c4f/src/app_service/service/accounts/service.nim#L417-L438

Could be that we don't need to update the old endpoints, if this PR and status-im/status-desktop#14139 are going to be released in same milestone. There's a keycard case though, which is not yet switch to new endpoints (#4977) 🤔

cc @mprakhov @jrainville

@@ -74,6 +76,10 @@ func ValidateAccountCreationRequest(c CreateAccount) error {
return ErrCreateAccountInvalidDisplayName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's parametrisation introduced here: #4980

@mprakhov
Copy link
Contributor Author

mprakhov commented Mar 28, 2024

@igor-sirotin From what I see you don't validate displayName it CreateAccount request in your PR https://github.com/status-im/status-go/pull/4980/files#diff-72e82d46a5b423433fa83a3b481cc1bca33709bba279f8c875a0613eec435e1eR85-R86

This PR will just add this check. I don't think there will be a huge conflicts

@igor-sirotin
Copy link
Contributor

This PR will just add this check. I don't think there will be a huge conflicts

@mprakhov sure, that's cool!
But we should probably keep status-im/status-desktop#14128 opened until my PR is merged as well.

Or do we want/need to ensure that old endpoints are fine as well? I wonder what will happen with keycard account creation even with my PR. @jrainville

@mprakhov
Copy link
Contributor Author

mprakhov commented Mar 28, 2024

But we should probably keep status-im/status-desktop#14128 opened until my PR is merged as well.

Up to you, I can put these changes into your branch in order to test all changes in one PR :)

@mprakhov
Copy link
Contributor Author

mprakhov commented Mar 28, 2024

Taking into account that @igor-sirotin merged his changes already, will rebase on develop branch and merge mine. No sense in postponing now :)
P.S. Auto close of the ticket will link to Igor's status-desktop PR

@mprakhov mprakhov merged commit e4c1abb into develop Mar 28, 2024
7 checks passed
@mprakhov mprakhov deleted the mp/issue-14128 branch March 28, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants