fixup! TF-4224 Reduce ReDoS vulnerability
This commit is contained in:
@@ -14,6 +14,10 @@ import 'package:tmail_ui_user/main/universal_import/html_stub.dart' as html;
|
||||
class AppUtils {
|
||||
const AppUtils._();
|
||||
|
||||
static final _emailLocalhostRegex = RegExp(
|
||||
r'^(?:"[^"\r\n]+"|[^<>()[\]\\.,;:\s@"]+(?:\.[^<>()[\]\\.,;:\s@"]+)*)@localhost$',
|
||||
);
|
||||
|
||||
static Future<void> loadEnvFile() async {
|
||||
await dotenv.load(fileName: AppConfig.envFileName);
|
||||
final mapEnvData = Map<String, String>.from(dotenv.env);
|
||||
@@ -53,9 +57,7 @@ class AppUtils {
|
||||
|
||||
static bool isEmailLocalhost(String email) {
|
||||
final normalized = email.trim();
|
||||
return RegExp(
|
||||
r'^(?:"[^"\r\n]+"|[^<>()[\]\\.,;:\s@"]+(?:\.[^<>()[\]\\.,;:\s@"]+)*)@localhost$'
|
||||
).hasMatch(normalized);
|
||||
return _emailLocalhostRegex.hasMatch(normalized);
|
||||
}
|
||||
|
||||
static void copyEmailAddressToClipboard(BuildContext context, String emailAddress) {
|
||||
|
||||
Reference in New Issue
Block a user