mxaccesscli: add --secured / --verifier-* options for WriteSecured

WriteCommand grows three new options:

  --secured                Route the write through
                           LMXProxyServer.WriteSecured(currentUserId,
                           verifierUserId, value) instead of plain
                           Write(value, userId). Required for attributes
                           classified as Secured Write or Verified Write,
                           and useful for testing whether the audit
                           subsystem propagates user identity when
                           explicitly told the write is "secured".

  --verifier-username      Galaxy / OS username of the verifier for a
                           two-person Verified Write. Implies --secured.
  --verifier-domain        Domain composed with --verifier-username as
                           '<domain>\<username>'.
  --verifier-password      Verifier password. Redacted in the JSON
                           query echo.

When --secured is on without a verifier, the same auth_user_id is
used for both currentUserId and verifierUserId (single-user Secured
Write semantics). When a verifier is provided, the CLI authenticates
both users and bails cleanly with "verifier-authentication-failed"
on a verifier credential mismatch.

The JSON envelope's results[] gains `secured` and `verifier_user_id`
fields so an agent can confirm which path ran.

MxItem grows WriteSecured(value, currentUserId, verifierUserId).

Verified live against TestMachine_001.TestAlarm002.AckMsg under
eOSUserBased + ArchestraUsers role: --secured succeeds with
auth_user_id=1, verifier_user_id=1, MxCategoryOk. User_Name in the
Historian Events row remains NULL — same as plain Write. The
audit-attribution gate is not Write vs WriteSecured; running engines
likely still need a redeploy to pick up the new security mode.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-05-03 23:48:17 -04:00
parent 68eb9adae7
commit c8f31bd653
2 changed files with 59 additions and 3 deletions
+11
View File
@@ -58,6 +58,17 @@ namespace MxAccess.Cli.Mx
public void Write(object value, int userId = 0) =>
_proxy.Write(_hServer, Handle, value, userId);
/// Two-user Secured/Verified write. Propagates the user identity into
/// the alarm/event audit trail in a way that the engine's audit
/// subsystem honors for Secured Write / Verified Write attribute
/// security classifications.
///
/// For single-user Secured Write, pass the same id for both
/// `currentUserId` and `verifierUserId`. For two-person Verified Write,
/// pass two distinct authenticated user ids (operator + verifier).
public void WriteSecured(object value, int currentUserId, int verifierUserId) =>
_proxy.WriteSecured(_hServer, Handle, currentUserId, verifierUserId, value);
public void Dispose()
{
if (_disposed) return;