fix(templateengine): delete dead SiteService data-connection create/update that audited raw credentials (review 2026-10-21 08/C1)

This commit is contained in:
Joseph Doherty
2026-10-22 06:26:03 -04:00
parent 4102922640
commit c0792cff3e
2 changed files with 16 additions and 80 deletions
@@ -98,20 +98,19 @@ public class SiteServiceTests
Assert.True(result.IsSuccess);
}
/// <summary>Verifies that creating a data connection with valid input succeeds.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task CreateDataConnection_ValidInput_Success()
/// <summary>
/// Review 2026-10-21 08/C1: SiteService must not offer a data-connection create/update
/// that audits the raw <c>DataConnection</c> entity — its Primary/BackupConfiguration
/// can embed protocol credentials, which would land in plaintext in the indefinitely
/// retained config audit. The Management Service path (which audits the scrubbed
/// public shape) is the only writer.
/// </summary>
[Theory]
[InlineData("CreateDataConnectionAsync")]
[InlineData("UpdateDataConnectionAsync")]
public void SiteService_HasNoRawDataConnectionWriter(string method)
{
_repoMock.Setup(r => r.SaveChangesAsync(It.IsAny<CancellationToken>()))
.ReturnsAsync(1);
var result = await _sut.CreateDataConnectionAsync(1, "OPC-Server1", "OpcUa", "{\"url\":\"opc.tcp://localhost\"}", null, 3, "admin");
Assert.True(result.IsSuccess);
Assert.Equal("OPC-Server1", result.Value.Name);
Assert.Equal("OpcUa", result.Value.Protocol);
Assert.Equal(1, result.Value.SiteId);
Assert.Null(typeof(SiteService).GetMethod(method));
}
/// <summary>Verifies that updating a site with valid input succeeds.</summary>