fix: correct regex escape for hyphen in FCM token validation
This commit is contained in:
@@ -6,5 +6,5 @@ export function isValidFcmToken(value: unknown): value is string {
|
|||||||
// FCM registration tokens are opaque. In practice they're ~140–250 chars of
|
// FCM registration tokens are opaque. In practice they're ~140–250 chars of
|
||||||
// [A-Za-z0-9:_-]. Be permissive on length; strict on charset to block
|
// [A-Za-z0-9:_-]. Be permissive on length; strict on charset to block
|
||||||
// obvious garbage without rejecting future token formats.
|
// obvious garbage without rejecting future token formats.
|
||||||
return typeof value === 'string' && value.length >= 64 && value.length <= 4096 && /^[A-Za-z0-9:_\-]+$/.test(value);
|
return typeof value === 'string' && value.length >= 64 && value.length <= 4096 && /^[A-Za-z0-9:_-]+$/.test(value);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user