fix(secrets): audit malformed ${secret:} tokens, cap SecretName at 450, resolve local UNC shares (scadaproj#52)

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 15:38:36 -05:00
parent 4a3c4e9b7e
commit ebc493361e
8 changed files with 236 additions and 6 deletions
@@ -27,6 +27,16 @@ public class SecretNameTests
public void RejectsRootedOrEmptySegment(string input)
=> Assert.Throws<ArgumentException>(() => new SecretName(input));
[Fact]
public void AcceptsExactlyMaxLength_AndRejectsOneOver()
{
Assert.Equal(450, SecretName.MaxLength);
Assert.Equal(450, new SecretName(new string('a', 450)).Value.Length);
Assert.Throws<ArgumentException>(() => new SecretName(new string('a', 451)));
// Length is measured after trim/lowercase normalization.
Assert.Equal(450, new SecretName(" " + new string('A', 450) + " ").Value.Length);
}
[Fact]
public void DefaultInstance_ThrowsOnValue()
=> Assert.Throws<InvalidOperationException>(() => _ = default(SecretName).Value);