VoterIdentity: anchor the device id grammar at \z so a trailing newline or control char is no second identity

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-10 09:55:26 +02:00
commit abb0986508
2 changed files with 20 additions and 1 deletions

View file

@ -8,7 +8,7 @@ public sealed record VoterIdentity(string Key, VoterClass Class, Guid? UserAccou
{
public const int MaxKeyLength = 120;
private static readonly Regex DeviceIdShape = new("^[A-Za-z0-9_-]{1,100}$", RegexOptions.CultureInvariant);
private static readonly Regex DeviceIdShape = new(@"^[A-Za-z0-9_-]{1,100}\z", RegexOptions.CultureInvariant);
// The one place a voter key and class are decided. Never reads vote weight.
public static VoterIdentity? For(CurrentBifrostActor actor, string? deviceId)