HomePhabricator

[Cashtab] Add blacklist for token name and token ticker fields

Description

[Cashtab] Add blacklist for token name and token ticker fields

Summary: Related to T2731. Added blacklist for token name and token ticker fields in CreateTokenForm.js, for blacklisted names with spaces, a version has been included with the space removed. Changed logic in isValidTokenName and isValidTokenTicker to set user input toLowerCase, trim leading and trailing spaces, filters excess spaces between words, joining the strings on a single space to test against the banned array. Also added logic to deal with cases where the user adds spaces between letters (ex. e c a s h). Changed test in validation.test.js that used 'doge' as an example. bannedTokenNames and bannedTokenTickers are cross checked in each input to avoid scammers swapping names / tickers to get around the ban.

Test Plan:
cd web/cashtab && npm start
navigate to Create Token form
input valid token names and token tickers
observe that there is no error
input various combinations of banned tickers and banned names in each input
add and remove spaces between letters
add leading and trailing spaces
observe that there is a valdation error for any of the bannedTokenTickers and bannedTokenNames

Reviewers: bytesofman, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D12194

Details

Provenance
kieran709Authored on Oct 10 2022, 16:02
kieran709Pushed on Oct 27 2022, 16:56
Reviewer
Restricted Project
Differential Revision
D12194: [Cashtab] Add blacklist for token name and token ticker fields
Parents
rABCed2be0238a0c: [Cashtab] [airdrop chronik for mint address p2/2] Deprecate bch-api for getting…
Branches
Unknown
Tags
Unknown