CORDA-2837 Prevent node running SwapIdentitiesFlow from initiating session with itself (#5457)

This commit is contained in:
willhr3 2019-09-10 16:25:33 +01:00 committed by Roger Willis
parent aad2e82d07
commit 33055702a8

View File

@ -90,10 +90,12 @@ private constructor(private val otherSideSession: FlowSession?,
@Suspendable
override fun call(): LinkedHashMap<Party, AnonymousParty> {
val session = otherSideSession ?: run {
val session = if (otherParty != null && otherParty != otherSideSession?.counterparty) {
logger.warnOnce("The current usage of SwapIdentitiesFlow is unsafe. Please consider upgrading your CorDapp to use " +
"SwapIdentitiesFlow with FlowSessions. (${CordappResolver.currentCordapp?.info})")
initiateFlow(otherParty!!)
initiateFlow(otherParty)
} else {
otherSideSession!!
}
progressTracker.currentStep = GENERATING_IDENTITY
val ourAnonymousIdentity = serviceHub.keyManagementService.freshKeyAndCert(ourIdentityAndCert, false)