fix(heidenhain): refuse literal credentials and writable/mistyped tags at the save path (#803 review)

- Review 1: RawTreeService Create/UpdateDriver and Create/UpdateDevice refuse a Heidenhain
  config whose password fields are not blank / secret:heidenhain/... / env:OTOPCUA_HEIDENHAIN_...
  (DriverConfigSaveGate over HeidenhainOptionsParser.DescribeCredentialProblems: top level,
  Access, Devices[], case-insensitive keys; the value is never echoed), so a literal password
  never reaches the draft DB. The driver and device modals show the reason and disable Save.
- Review 8: CreateTag/UpdateTag/ImportTags (tag modal, manual entry, CSV import, browse commit)
  refuse a ReadWrite Heidenhain tag or a Tag.DataType that disagrees with what the driver
  publishes (HeidenhainTagRules: catalog type, Float64 => Double, or the binding's dataType).
  The tag modal and manual-entry grid fix the access level at Read and derive the data type from
  the address (RawTagRowDefaults). New deploy gate HeidenhainTagDataTypeMismatch.
- docs/drivers/Heidenhain.md: credential namespace convention + why, the save-path and deploy
  enforcement, optional-role credential behaviour, BadConfigurationError, backoff/ordering notes.

Tests: HeidenhainSavePathTests (service save path; red with the gates disabled) and new
DraftValidatorHeidenhainTests cases.
This commit is contained in:
Joseph Doherty
2026-11-10 23:54:32 -05:00
parent f7a3588b24
commit 54f58c583c
15 changed files with 427 additions and 33 deletions
@@ -30,6 +30,9 @@ public static class HeidenhainDeployChecks
/// <summary>A literal password in a Heidenhain DriverConfig/DeviceConfig.</summary>
public const string CredentialCode = "HeidenhainCredentialPersisted";
/// <summary>A Heidenhain tag whose <c>Tag.DataType</c> disagrees with the type the driver publishes.</summary>
public const string DataTypeCode = "HeidenhainTagDataTypeMismatch";
/// <summary>Invalid Heidenhain settings or endpoint.</summary>
public const string ConfigCode = "HeidenhainConfigInvalid";
@@ -56,6 +59,16 @@ public static class HeidenhainDeployChecks
tag.TagId));
}
foreach (var tag in tags)
{
var expected = HeidenhainTagRules.ExpectedTagDataType(tag.TagConfig);
if (expected is null || string.Equals(expected, tag.DataType, StringComparison.OrdinalIgnoreCase)) continue;
errors.Add(new(DataTypeCode,
$"Tag '{tag.Name}' on Heidenhain driver '{driver.Name}' has data type {tag.DataType}, but the driver " +
$"publishes {expected} for its address — the node would advertise a type its values never carry.",
tag.TagId));
}
HeidenhainDriverOptions options;
try
{