feat(grpc-data): #1084 secured writes over a data connection need an export-level opt-in; #1091 Galaxy reports gRPC write outcomes definitively
#1084 - DataExport.AllowSecuredWrites (default false; migration AddDataExportAllowSecuredWrites, a bit NOT NULL DEFAULT 0 column, no constraint => no MigrationPreChecks twin; the preflight's legacy-schema tolerance covers the missing column). - Valid only with Write: validator code DataExportSecuredWriteInvalid at authoring, the deploy gate and on a deployed row (an artifact row breaking it fails closed), modelled on AllowGalaxyServiceAck. - LocalExportCatalog keeps it per rule (counts only with Write) and answers AllowsSecuredWrite(principal, node): an export of the principal, in the node's realm, granting Write, opted in, whose root contains the node. - DataWriteExecutor stamps DataWriteAdmission.AllowsSecuredWrite (new, default false) from the catalog generation that admitted the write (re-checked by the dispatch gate's commit), never from the request. - DriverInstanceActor.RichCaller returns null without it, so the driver gets NO caller: the driver option MxAccess.SecuredWritesOverDataConnections alone no longer lets a forwarding consumer cluster's link key write SecuredWrite attributes. Fail closed by default. - AdminUI export editor: "Allow secured writes under this peer's key identity" checkbox (enabled only with Write). #1091 (a) - GalaxyDriver implements IWriteOutcomeCapability + ICallerAwareWriteOutcomeCapability. GalaxyWriteOutcomes maps BadUserAccessDenied and the OnWriteComplete verdicts BadNotWritable/BadTypeMismatch/BadOutOfRange/ BadConfigurationError to DriverConfirmedFailure, Good to AcceptedUnconfirmed (a provisional Good is indistinguishable), everything else to OutcomeUnknown. A refused secured write is now a definite BadUserAccessDenied, not OutcomeUnknown. - RunRichWriteAsync precedence: caller-aware outcome overload (caller present) -> outcome overload -> ICallerAwareWritable (caller present) -> IWritable. Both earlier behaviours kept; the OPC UA path is unchanged. Tests (each failed before its fix where applicable): - End to end through the runtime path (artifact -> catalog -> DataWriteRuntime executor -> ActorDataWriteRoute -> DriverInstanceActor behind the real dispatch gate -> real GalaxyDriver): export opt-in x driver option matrix; only both commit as the key's identity, either alone refuses BadUserAccessDenied definitively with no identity lookup. Ignoring the flag in RichCaller fails 3 tests. - Catalog scope (root containment, Write, principal), artifact round-trip + fail-closed row, validator, migration SQL + no pending model changes, AdminUI checkbox enable/save (bUnit), actor precedence, Galaxy outcome mapping. - ScriptForeignKeysAndExternalIdUniquenessMigrationTests now migrate to THEIR migration, not the latest. Docs: DataConnections.md (two-gate table), Galaxy.md, security.md, rules/drivers.md.
This commit is contained in:
@@ -144,7 +144,10 @@ internal sealed class DataWriteExecutor(DataAuthenticatedContext context, Func<L
|
||||
var issued = clock.GetTimestamp();
|
||||
var admission = new DataWriteAdmission(context.PrincipalId, node.Metadata.View, current.AuthorityEpoch,
|
||||
current.Serving.CatalogEpoch, current.Serving.Incarnation, target.DriverIncarnation, item.OperationId,
|
||||
expiration, context.ApiKeyId, context.CredentialExpiresUtc, context.CredentialVersion);
|
||||
expiration, context.ApiKeyId, context.CredentialExpiresUtc, context.CredentialVersion,
|
||||
// #1084: decided here, from the same catalog generation that admitted the write (the dispatch gate's commit
|
||||
// re-checks that generation), never from the request.
|
||||
AllowsSecuredWrite: current.AllowsSecuredWrite(context.PrincipalId, node));
|
||||
var scope = new FrozenWriteScope(node.Scope.ClusterId, node.Scope.Kind, node.Scope.Segments.ToImmutableArray());
|
||||
var proof = new WriteRouteProof(admission, scope, node.EntityKind, node.EntityId, node.Source,
|
||||
target.DriverInstanceId, target.DriverReference, target.RouteGeneration, target.PrimaryGeneration, current.Serving);
|
||||
|
||||
Reference in New Issue
Block a user