Skip to content

Transfer/ error when attempting to transfer to blacklisted address - #2622

Merged
JIOjosBG merged 4 commits into
v2from
add/warn-tranfer-scam
Aug 18, 2026
Merged

Transfer/ error when attempting to transfer to blacklisted address#2622
JIOjosBG merged 4 commits into
v2from
add/warn-tranfer-scam

Conversation

@JIOjosBG

@JIOjosBG JIOjosBG commented Aug 13, 2026

Copy link
Copy Markdown
Member

Resolves: https://github.com/AmbireTech/ambire-app/issues/7716

To test

Get some address from the backend and try to transfer funds to it https://cena.ambire.com/api/v3/scamchecker/data

image

@JIOjosBG
JIOjosBG requested a review from PetromirDev August 13, 2026 16:23
@JIOjosBG JIOjosBG self-assigned this Aug 13, 2026
@JIOjosBG JIOjosBG added the enhancement New feature or request label Aug 13, 2026
Comment thread src/controllers/phishing/phishing.ts Outdated
Comment on lines +693 to +700
// The list may hold addresses in any casing, while the checked address can come straight from
// user input (typed, pasted or resolved from a name). Compare every common form, so that a
// lowercase input is never treated as safe only because the list holds it checksummed.
if (this.#addresses.has(address) || this.#addresses.has(address.toLowerCase()))
return 'BLACKLISTED'

try {
if (this.#addresses.has(getAddress(address))) return 'BLACKLISTED'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you sure? The addresses returned by the api seem all lowercase. Can you do a quick check with a script and if that's true, lowercase them on add() to ensure that they will be so in the future, add a comment and only check the lowercase version here. I know it's not from this PR, but it's not a good practice to trust the API when storing data and not updating it often.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the backend currently returns only lower case addresses, but it was not forced by the backend, this is simply how addresses happen to be stored in the upstream github repos. I will update the phishing controller to parse addresses to be lower case always and remove the extra logic here

Comment thread src/controllers/phishing/phishing.ts Outdated
Comment on lines +287 to +290
this.#addresses = new Set(phishing.addresses)
// Normalized to lowercase so getAddressBlacklistedStatus can do a plain lookup, regardless of
// the casing the relayer (or, for pre-normalization storage, an older app version) used.
this.#addresses = new Set(phishing.addresses.map((address: string) => address.toLowerCase()))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are 4599 addresses which isn't a lot but this will be calculated every time that the mobile app is open. I know it should be rather lightweight, but it's still best practice to do this as a migration instead. Wdyt, is it worth it to write a migration?

@PetromirDev PetromirDev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the new init() map and lfg

@JIOjosBG
JIOjosBG merged commit 6c83077 into v2 Aug 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants