Further restrict E164 format in storage service

This commit is contained in:
Fedor Indutny 2023-02-15 17:06:10 -08:00 committed by GitHub
parent 3d735acdec
commit 260c1fd9df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ export function validateConversation(
function validateNumber(attributes: ValidateConversationType): string | null {
const { e164 } = attributes;
if (isDirectConversation(attributes) && e164) {
if (!/^\+[0-9]{1,19}$/.test(e164)) {
if (!/^\+[1-9][0-9]{0,18}$/.test(e164)) {
return 'Invalid E164';
}