Page MenuHomePhabricator

[Cashtab] [Alias] Enforce alphanumeric inputs
ClosedPublic

Authored by emack on Mar 10 2023, 23:22.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABCe013fc331676: [Cashtab] [Alias] Enforce alphanumeric inputs
Summary

T2551

As per feedback from beta testing, the initial release will be limited to lowercase alphanumeric inputs.

Test Plan
  • enable Alias in ticker.js
  • npm start
  • navigate to Alias.js and ensure lowercase a-z and 0-9 inputs within 21 bytes are all accepted and successfully registered
  • ensure zero-width spaces, special characters, non-english characters and emojis are invalid.

*new tests*

  • open a wallet that has registered non-alphanumeric aliases prior to this diff
  • observe console log message Non-alphanumeric alias detected in cache, resetting aliasCache and a full alias tx history retrival is triggered
  • navigate to Alias.js and ensure the registered list only shows alphanumeric aliases
  • register a new alias and ensure only partial alias tx history retrieval is triggered
  • inspect aliasCache in localforage and ensure no non-alphanumeric aliases in alias array. Also note the size of paymentTxHistory being much larger than aliases due to the invalidation of previously valid non-alphanumeric aliases.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
alphanumericAlias
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22345
Build 44316: Build Diffcashtab-tests
Build 44315: arc lint + arc unit

Event Timeline

emack requested review of this revision.Mar 10 2023, 23:22

We also need to

  • burn alias cache for wallets with alias cache
  • modify functions that determine valid aliases to invalidate all registrations that do not fit this alphanumeric input
web/standards/xec-alias.md
70 ↗(On Diff #38403)

The intent of the alias feature is to get away from some of the clunkiness of addresses. One issue with addresses is that they are human unreadable and thus must always be copy pasted to ensure accuracy.

If one alias can be human indistinguishable from another alias, then all aliases will also be copy-paste only inputs.

This revision now requires changes to proceed.Mar 10 2023, 23:51
emack marked an inline comment as done.
  • getAliasesFromLocalForage updated to burn alias cache for wallets with alias caches containing non-alphanumeric aliases
  • getAliasAndAddresses updated to invalidate all non-alphanumeric registrations. Since this is the gateway function to validating aliases into cache, no further changes are needed on downstream functions.
  • added isAlphanumeric helper function along with associated unit tests
  • updated spec with feedback
  • note updated test plan above
This revision is now accepted and ready to land.Mar 12 2023, 22:47
This revision was automatically updated to reflect the committed changes.