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

PreCreateWallet: Replace more name chars. #3511

Merged
merged 2 commits into from
Jul 13, 2021

Conversation

JoeGruffins
Copy link
Member

@JoeGruffins JoeGruffins commented Jun 16, 2021

Disallow some problematic characters in wallet names.

closes #3359

This works in the same way it did before, just adds a few more characters to the replace and doesn't allow for leading spaces. space, +, -, _, and : look to be fine on linux, but Windows may be more restrictive. Will test there if noone else can. Parenthesis and brackets may also be fine and used by some people. Allow?

@JoeGruffins
Copy link
Member Author

It might also be better to change to only allow a certain set, which may be more complete. I think some windows systems in different languages have other special characters.

Disallow some problematic characters in wallet names.
@JoeGruffins
Copy link
Member Author

@degeri Any opinion on what to allow or disallow?

@degeri
Copy link
Member

degeri commented Jun 18, 2021

Cant we go for a whitelist ?

a-z,A-Z,0-9

@matheusd
Copy link
Member

Cant we go for a whitelist ?

a-z,A-Z,0-9

This would be too restrictive for non-US speakers (e.g. can't name a wallet ¨Poupança").

@degeri
Copy link
Member

degeri commented Jun 28, 2021

Cant we go for a whitelist ?
a-z,A-Z,0-9

This would be too restrictive for non-US speakers (e.g. can't name a wallet ¨Poupança").

Yes it would be. The problem is that if we extend to many languages we will hit alot of problems like R->L chars, Long chars ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ etc. Not sure how we handle that currently tbh.

Maybe we should test with https://github.com/minimaxir/big-list-of-naughty-strings/blob/master/blns.json and see which cause errors/inconsistencies .

@degeri
Copy link
Member

degeri commented Jun 28, 2021

After much discussion @matheusd and me came to the conclusion that denying any unicode char (Unless it specifically causes and issue) will be bad UX for users.

Even the bug due to # was due to a dependency escaping the char. https://github.com/npm/ini/blob/master/ini.js#L159

@matheusd
Copy link
Member

To expand a bit on degeri's comment:

Users should be able to (at least in principle) use any wallet name they so choose. However, certain special chars need to be explicitly filtered due to us directly using the wallet name as part of the path to the wallet's files. The list of chars that I believe need to be filtered out are:

@JoeGruffins
Copy link
Member Author

Blacklisting suggested chars. Thank you.

Comment on lines +63 to +64
if (newWalletName.length > 0 && newWalletName[0] === " ")
newWalletName = newWalletName.slice(1);
Copy link
Member

Choose a reason for hiding this comment

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

You could have multiple spaces, so best to just use trim()

Copy link
Member Author

Choose a reason for hiding this comment

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

How do you mean. It runs this code every key press, so trim disallows any spaces at all. I could put trim in somewhere else I suppose?

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we also disallow spaces? I just thought a leading space was silly and confusing, but something like "My Wallet" should be fine.

@alexlyp alexlyp merged commit db9c321 into decred:master Jul 13, 2021
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.

[bug] specific special characters as wallet names cause decrediton errors
4 participants