-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[server] don't allow more than three usages per phone number #13186
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Thank you, Sven 🙏
Looking at the code out of curiosity found something you will notice also pretty quickly :)
PS: Would it make sense and be sensible to also stop overriding the phone number on delete as part of this (here)? Asking because a potential way for an abuser to avoid both these checks is requesting the account to be deleted.
@@ -59,6 +60,14 @@ export class VerificationService { | |||
if (!this.verifyService) { | |||
throw new Error("No verification service configured."); | |||
} | |||
const isBlockedNumber = this.userDB.countUsagesOfPhoneNumber(phoneNumber); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isBlockedNumber = this.userDB.countUsagesOfPhoneNumber(phoneNumber); | |
const isBlockedNumber = this.userDB.isBlockedPhoneNumber(phoneNumber); |
2430319
to
0b53ef5
Compare
0b53ef5
to
e504643
Compare
components/gitpod-db/src/typeorm/migration/1663784254956-IndexPhoneNumber.ts
Show resolved
Hide resolved
/werft run 👍 started the job as gitpod-build-sefftinge-limit-phone-number-re-12883.3 |
/hold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes as per internal thread
ba37cf5
to
6b55247
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one comment about correctly distinguishing user errors and server errors.
/hold
throw new Error("The given phone number has been used more than three times."); | ||
} | ||
if (await isBlockedNumber) { | ||
throw new Error("The given phone number is blocked due to abuse."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we throw this as a user error here? Otherwise it will count towards server errors in our metrics.
* @param phoneNumber | ||
* @returns formatted phone number | ||
*/ | ||
export function formatPhoneNumber(phoneNumber: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
6b55247
to
dd09f79
Compare
/unhold |
Description
Adds checks for phone numbers being used by abusers or used too often (>3)
Related Issue(s)
Fixes #12883
How to test
Release Notes
Documentation
Werft options:
If enabled this will build
install/preview
Valid options are
all
,workspace
,webapp
,ide