fix: correct regex escape for hyphen in FCM token validation

This commit is contained in:
Linus Rath
2026-04-20 12:08:41 +02:00
parent 578e60c0bc
commit 00dec8c5a0
+1 -1
View File
@@ -6,5 +6,5 @@ export function isValidFcmToken(value: unknown): value is string {
// FCM registration tokens are opaque. In practice they're ~140250 chars of
// [A-Za-z0-9:_-]. Be permissive on length; strict on charset to block
// 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);
}