fix(transport): secret-bearing bundle export needs Administrator; scrub data-connection move reply (MGT-3, MGT-4, WP1 task 1.5)

MGT-3: a Designer could read SMTP/SMS credentials, external-system auth,
DB connection strings and data-connection configuration through bundle
export, values the management API returns to no one. Both export
surfaces now resolve the selection (dependencies included) via the new
IBundleExporter.CountSecretsAsync / ExportSecretPolicy and require
Administrator when it carries any secret; a secret-free export stays a
Designer operation. The ExportBundle gate becomes any-of [Designer,
Administrator] - a deliberate change to the frozen authz matrix. A new
ManagementAuthorizationException maps to ManagementUnauthorized.

MGT-4: data-connection move replies with DataConnectionPublicShape like
its siblings (the audit after-state switched with task 1.4).

Tests: matrix entry, Designer+secrets refused (nothing exported), Admin
and secret-free Designer succeed, UI wizard refuses a Designer, policy
counts every SecretsBlock field, move reply carries no secret.
This commit is contained in:
Joseph Doherty
2026-12-03 10:04:28 -05:00
parent 5ca998dc56
commit 8c5d70f687
12 changed files with 335 additions and 43 deletions
@@ -19,4 +19,16 @@ public interface IBundleExporter
string sourceEnvironment,
string? passphrase,
CancellationToken cancellationToken = default);
/// <summary>
/// Resolves <paramref name="selection"/> exactly as <see cref="ExportAsync"/> would
/// (dependencies included) and counts the stored secret fields the bundle would carry —
/// external-system auth, SMTP/SMS credentials, DB connection strings, data-connection
/// configuration. A non-zero count means the export needs the Administrator role
/// (code review 2026-12-02 MGT-3).
/// </summary>
/// <param name="selection">The export selection.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>The number of non-empty secret fields in the resolved export.</returns>
Task<int> CountSecretsAsync(ExportSelection selection, CancellationToken cancellationToken = default);
}