Page MenuHomePhabricator

[alias-server] Add function to query database by alias
ClosedPublic

Authored by bytesofman on Jun 21 2023, 18:32.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCe2d3fc979b99: [alias-server] Add function to query database by alias
Summary

T3060

Add new database function to lookup a valid alias registration by address. This function will be implemented in a later diff to create an API endpoint used to check if a given alias is available to be registered.

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested changes to this revision.Jun 22 2023, 14:23
Fabien added a subscriber: Fabien.
Fabien added inline comments.
apps/alias-server/src/db.js
175 ↗(On Diff #40915)

You should also check for min length

apps/alias-server/test/dbTests.js
240 ↗(On Diff #40915)

? That's not too long, but it's the wrong type

This revision now requires changes to proceed.Jun 22 2023, 14:23
bytesofman marked an inline comment as done.

Check for min length, correct mislabeled var name

Fabien requested changes to this revision.Jun 23 2023, 06:46

What is the plan for DoS prevention when this becomes publicly accessible ? It does a DB lookup for every alias passed.

apps/alias-server/src/db.js
177 ↗(On Diff #40935)

That's the good time to create an aliasConstants.minLength constant.
Out of scope for this diff: is a 1 byte alias even relevant ?

This revision now requires changes to proceed.Jun 23 2023, 06:46

What is the plan for DoS prevention when this becomes publicly accessible ? It does a DB lookup for every alias passed.

In the interest of launching as soon as practical, will probably limit calls to whitelisted domains, i.e. Cashtab.com, or any wallet that requests access. This implementation is quite simple.

Will need to implement rate limiting to support calls from arbitrary IP addresses and handle DoS. This might also be quite straightforward but will need to scope it out.

apps/alias-server/src/db.js
177 ↗(On Diff #40935)

While 1-byte aliases will be (perhaps) prohibitively expensive in phase 1, they will be part of the system.

Add aliasConstants.minLength

This revision is now accepted and ready to land.Jun 23 2023, 15:43