feat(secrets): source LDAP bind password via ${secret:ldap/mxgateway/bind}; drop plaintext defaults (G-4)
This commit is contained in:
@@ -32,6 +32,26 @@ public sealed class PreHostSecretExpansionTests
|
||||
Assert.Equal(plaintext, config["MxGateway:Ldap:ServiceAccountPassword"]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// G-4: the shipped <c>appsettings.json</c> sources the LDAP bind password from
|
||||
/// <c>${secret:ldap/mxgateway/bind}</c>. Proves that exact reference at that exact key resolves to
|
||||
/// the seeded plaintext through the same pre-host expander the host runs.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task ExpandConfiguration_LdapBindReference_ResolvesToSeededPassword()
|
||||
{
|
||||
using var fixture = SecretsFixture.Create();
|
||||
const string bindPassword = "seeded-bind-password";
|
||||
await fixture.SeedAsync("ldap/mxgateway/bind", bindPassword);
|
||||
|
||||
IConfigurationRoot config = fixture.BuildConfig(
|
||||
("MxGateway:Ldap:ServiceAccountPassword", "${secret:ldap/mxgateway/bind}"));
|
||||
|
||||
await new SecretReferenceExpander(fixture.Resolver).ExpandConfigurationAsync(config, default);
|
||||
|
||||
Assert.Equal(bindPassword, config["MxGateway:Ldap:ServiceAccountPassword"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExpandConfiguration_MissingReference_ThrowsFailClosed()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user