From 3aa4e62f28861e3b7988b662b859ca69d53a66af Mon Sep 17 00:00:00 2001 From: Eauldane Date: Sun, 14 Sep 2025 23:09:57 +0100 Subject: [PATCH] Yeah this should just be a string.StartsWith. --- .../Services/AccountRegistrationService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MareSynchronosServer/MareSynchronosAuthService/Services/AccountRegistrationService.cs b/MareSynchronosServer/MareSynchronosAuthService/Services/AccountRegistrationService.cs index 42d731b..21d8091 100644 --- a/MareSynchronosServer/MareSynchronosAuthService/Services/AccountRegistrationService.cs +++ b/MareSynchronosServer/MareSynchronosAuthService/Services/AccountRegistrationService.cs @@ -32,7 +32,7 @@ public class AccountRegistrationService private readonly ILogger _logger; private readonly ConcurrentDictionary _registrationsPerIp = new(StringComparer.Ordinal); - private Regex _registrationUserAgentRegex = new Regex(@"^MareSynchronos/", RegexOptions.Compiled, TimeSpan.FromMilliseconds(50)); + public AccountRegistrationService(MareMetrics metrics, MareDbContext mareDbContext, IServiceScopeFactory serviceScopeFactory, IConfigurationService configuration, @@ -49,7 +49,7 @@ public class AccountRegistrationService { var reply = new RegisterReplyV2Dto(); - if (!_registrationUserAgentRegex.Match(ua).Success) + if (!ua.StartsWith("MareSynchronos/", StringComparison.Ordinal)) { reply.ErrorMessage = "User-Agent not allowed"; return reply;