mbproxy: fix dashboard review findings, add named BCD tags + fleet config
Reviewed the new SignalR dashboard and fixed its two top findings: a stored XSS on the connection-detail page (unescaped tag name / direction / timestamp rendered into innerHTML) and FC03/FC04 cache hits bypassing the debug-view capture, which left cached tags frozen while their age climbed. Also adds an optional human-friendly Name to BCD tags surfaced on the debug view, and loads the real fleet config from tags.txt (12 named BCD tags, PLC Z28061) so the published appsettings.json is deploy-ready. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,29 @@ public sealed class BcdTagMapBuilderTests
|
||||
t32.Width.ShouldBe((byte)32);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Build_CarriesOptionalTagName_IntoResolvedMap()
|
||||
{
|
||||
// The optional human-friendly Name flows from config options through to the
|
||||
// resolved BcdTag; an omitted Name resolves to null.
|
||||
var global = new BcdTagListOptions
|
||||
{
|
||||
Global =
|
||||
[
|
||||
new BcdTagOptions { Address = 1548, Width = 16, Name = "Left AirSP" },
|
||||
new BcdTagOptions { Address = 1080, Width = 32 },
|
||||
],
|
||||
};
|
||||
|
||||
var result = BcdTagMapBuilder.Build(global, perPlc: null);
|
||||
|
||||
result.Errors.ShouldBeEmpty();
|
||||
result.Map.TryGet(1548, out var named).ShouldBeTrue();
|
||||
named.Name.ShouldBe("Left AirSP");
|
||||
result.Map.TryGet(1080, out var unnamed).ShouldBeTrue();
|
||||
unnamed.Name.ShouldBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Build_PerPlcAdd_AppendsToGlobal()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user