private void Import(bool fake, TMessage message, Action modelAction, Principal producer, Principal sender, Principal realRequestProducer) { // Extract all fields before importing any, in case getKnownReaders // for one secret references information extracted from another // field. if (!fake) { foreach (var handler in fieldHandlers.Values) { handler.Extract(message); } } // Helpful VS suggestion... https://msdn.microsoft.com/en-us/library/dn986595.aspx modelAction?.Invoke(); // Set up secretsVerifiedOnImport field so RecordExtract can add to it. SVX_Ops.Transfer(message, producer, sender, realRequestProducer, BrowserOnly); foreach (var handler in fieldHandlers.Values) { handler.RecordExtract(message); if (!fake) { handler.Import(message, producer, sender); } } }
internal override void RecordExtract(TMessage message) { if (verifyOnImport) { ((SymTTransfer)message.SVX_symT).payloadSecretsVerifiedOnImport.Add(new VerifyOnImportEntry { fieldPath = accessor.name, secretGeneratorTypeFullName = generator.GetType().FullName }); var secret = accessor.Get(message); SVX_Ops.TransferNested(secret.theParams, generator.Signer); } // If unverified, we leave the SymT inactive, which is weird. // XXX: We should TransferNested. We just need the current // principal here in order to generate a facet for the producer. }
// target is the redirection target, null if not a redirection. // // Wow, there's a lot of code that is only used in a small fraction of // cases, but I still find it easiest to understand to have all the // logic in one method and then define various restricted entry points. // ~ REDACTED 2016-07-25 private void Export(bool fake, TMessage message, Principal receiver, Principal target, Principal requestProducer) { if (!fake) { if (target == null && BrowserOnly) { throw new InvalidOperationException("Server attempted to send a browser-only message."); } foreach (var handler in fieldHandlers.Values) { handler.Export(message, receiver, target); } } message.SVX_placeholderRequestProducer = requestProducer; // This mainly matters when we use in-process models for remote // participants and don't do a real serialize/deserialize pass // (currently; maybe we should). Try to wipe the active flags so we // fail secure if the SVX_Ops.Transfer is somehow skipped. Even // when fake = false, we're mutating secrets, so it's reasonable to // mutate the message this way as well. SVX_Ops.WipeActiveFlags(message); }