From f2dd3ac652a6fb529f6df929b1614fd7d385e065 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Sun, 1 Nov 2020 21:40:55 +0000 Subject: [PATCH 1/3] CORDA-4045 Disable flaky test (#6792) Disable `Restart does not set senderUUID` as it is unstable. --- .../net/corda/node/services/statemachine/RetryFlowMockTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/node/src/test/kotlin/net/corda/node/services/statemachine/RetryFlowMockTest.kt b/node/src/test/kotlin/net/corda/node/services/statemachine/RetryFlowMockTest.kt index a3bb5d520a..2e4ccdecc2 100644 --- a/node/src/test/kotlin/net/corda/node/services/statemachine/RetryFlowMockTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/statemachine/RetryFlowMockTest.kt @@ -36,6 +36,7 @@ import org.junit.After import org.junit.Assert.assertTrue import org.junit.Assume import org.junit.Before +import org.junit.Ignore import org.junit.Test import java.sql.SQLException import java.time.Duration @@ -99,6 +100,7 @@ class RetryFlowMockTest { assertEquals(2, SendAndRetryFlow.count) } + @Ignore("CORDA-4045: Disable flaky test") @Test(timeout=300_000) fun `Restart does not set senderUUID`() { val messagesSent = Collections.synchronizedList(mutableListOf()) From b421f0daa0f2c254512f019ea2cc113cb67049bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Waldemar=20=C5=BBurowski?= <45210402+wzur-r3@users.noreply.github.com> Date: Sun, 15 Nov 2020 21:36:25 +0100 Subject: [PATCH 2/3] INFRA-965: forward merge from 4.5 (2020-11-15) (#6806) * EG-4168 Updating contributors.md list for OS 4.5 release branch (#6784) * INFRA-965: forward merge from 4.4 (2020-11-14) (#6805) * EG-4168 Updating contributors.md list for OS 4.4 release branch (#6785) * INFRA-965: forward merge from 4.3 (2020-11-13) (#6803) * INFRA-965: Jenkins/NexusIQ integration should target patches (#6802) as well as major/minor releases * Updated nightly builds to match changes for release branch builds * Updated JDK11 builds to match changes for release branch builds Co-authored-by: ivanterziev <61829352+ivanterziev-r3@users.noreply.github.com> * Backporting updates for check-pr-title workflow Co-authored-by: ivanterziev <61829352+ivanterziev-r3@users.noreply.github.com> --- .ci/dev/compatibility/JenkinsfileJDK11Azul | 2 +- .ci/dev/publish-branch/Jenkinsfile.nightly | 2 +- .ci/dev/regression/Jenkinsfile | 2 +- .github/workflows/check-pr-title.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.ci/dev/compatibility/JenkinsfileJDK11Azul b/.ci/dev/compatibility/JenkinsfileJDK11Azul index cd1a2da800..a325b5a11a 100644 --- a/.ci/dev/compatibility/JenkinsfileJDK11Azul +++ b/.ci/dev/compatibility/JenkinsfileJDK11Azul @@ -82,7 +82,7 @@ pipeline { script { sh "./gradlew --no-daemon properties | grep -E '^(version|group):' >version-properties" /* every build related to Corda X.Y (GA, RC, HC, patch or snapshot) uses the same NexusIQ application */ - def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim() + def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\(\\.[0-9]\\+\\)\\+\\).*\$/\\1/'").trim() def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim() def artifactId = 'corda' nexusAppId = "${groupId}-${artifactId}-${version}" diff --git a/.ci/dev/publish-branch/Jenkinsfile.nightly b/.ci/dev/publish-branch/Jenkinsfile.nightly index df7f178cac..4b331e9f5d 100644 --- a/.ci/dev/publish-branch/Jenkinsfile.nightly +++ b/.ci/dev/publish-branch/Jenkinsfile.nightly @@ -67,7 +67,7 @@ pipeline { script { sh "./gradlew --no-daemon properties | grep -E '^(version|group):' >version-properties" /* every build related to Corda X.Y (GA, RC, HC, patch or snapshot) uses the same NexusIQ application */ - def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim() + def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\(\\.[0-9]\\+\\)\\+\\).*\$/\\1/'").trim() def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim() def artifactId = 'corda' nexusAppId = "${groupId}-${artifactId}-${version}" diff --git a/.ci/dev/regression/Jenkinsfile b/.ci/dev/regression/Jenkinsfile index f773438b4b..fb6e3896ff 100644 --- a/.ci/dev/regression/Jenkinsfile +++ b/.ci/dev/regression/Jenkinsfile @@ -100,7 +100,7 @@ pipeline { script { sh "./gradlew --no-daemon properties | grep -E '^(version|group):' >version-properties" /* every build related to Corda X.Y (GA, RC, HC, patch or snapshot) uses the same NexusIQ application */ - def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim() + def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\(\\.[0-9]\\+\\)\\+\\).*\$/\\1/'").trim() def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim() def artifactId = 'corda' nexusAppId = "${groupId}-${artifactId}-${version}" diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 2b4bab8016..ce097eb02a 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -7,8 +7,8 @@ jobs: check-pr-title: runs-on: ubuntu-latest steps: - - uses: morrisoncole/pr-lint-action@v1.1.1 + - uses: morrisoncole/pr-lint-action@v1.4.1 with: - title-regex: '^((CORDA|EG|ENT|INFRA)-\d+|NOTICK)(.*)' + title-regex: '^((CORDA|AG|EG|ENT|INFRA)-\d+|NOTICK)(.*)' on-failed-regex-comment: "PR title failed to match regex -> `%regex%`" repo-token: "${{ secrets.GITHUB_TOKEN }}" From 4e437ace2ad4d1acca503102d3e67274b644816a Mon Sep 17 00:00:00 2001 From: Dan Newton Date: Fri, 5 Feb 2021 16:05:55 +0000 Subject: [PATCH 3/3] CORDA-4110 startFlowDynamicWithClientId permissions (#6857) --- .../corda/node/flows/FlowWithClientIdTest.kt | 32 +++++++++++++++++++ .../rpc/proxies/AuthenticatedRpcOpsProxy.kt | 11 +++++++ 2 files changed, 43 insertions(+) diff --git a/node/src/integration-test/kotlin/net/corda/node/flows/FlowWithClientIdTest.kt b/node/src/integration-test/kotlin/net/corda/node/flows/FlowWithClientIdTest.kt index 17b4f36320..7e80b7d9a5 100644 --- a/node/src/integration-test/kotlin/net/corda/node/flows/FlowWithClientIdTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/flows/FlowWithClientIdTest.kt @@ -61,6 +61,38 @@ class FlowWithClientIdTest { } } + @Test(timeout = 300_000) + fun `start flow with client id permissions`() { + val user = User("TonyStark", "I AM IRONMAN", setOf("StartFlow.net.corda.node.flows.FlowWithClientIdTest\$ResultFlow")) + driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptySet())) { + val nodeA = startNode(rpcUsers = listOf(user)).getOrThrow() + nodeA.rpc.startFlowWithClientId(UUID.randomUUID().toString(), ::ResultFlow, 5).returnValue.getOrThrow(20.seconds) + nodeA.rpc.startFlowDynamicWithClientId( + UUID.randomUUID().toString(), + ResultFlow::class.java, + 5 + ).returnValue.getOrThrow(20.seconds) + } + } + + @Test(timeout = 300_000) + fun `start flow with client id without permissions`() { + val user = User("TonyStark", "I AM IRONMAN", setOf()) + driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptySet())) { + val nodeA = startNode(rpcUsers = listOf(user)).getOrThrow() + assertFailsWith { + nodeA.rpc.startFlowWithClientId(UUID.randomUUID().toString(), ::ResultFlow, 5).returnValue.getOrThrow(20.seconds) + } + assertFailsWith { + nodeA.rpc.startFlowDynamicWithClientId( + UUID.randomUUID().toString(), + ResultFlow::class.java, + 5 + ).returnValue.getOrThrow(20.seconds) + } + } + } + @Test(timeout = 300_000) fun `remove client id`() { val clientId = UUID.randomUUID().toString() diff --git a/node/src/main/kotlin/net/corda/node/internal/rpc/proxies/AuthenticatedRpcOpsProxy.kt b/node/src/main/kotlin/net/corda/node/internal/rpc/proxies/AuthenticatedRpcOpsProxy.kt index 1e0caa50a2..fcf8793779 100644 --- a/node/src/main/kotlin/net/corda/node/internal/rpc/proxies/AuthenticatedRpcOpsProxy.kt +++ b/node/src/main/kotlin/net/corda/node/internal/rpc/proxies/AuthenticatedRpcOpsProxy.kt @@ -5,6 +5,7 @@ import net.corda.core.flows.FlowLogic import net.corda.core.internal.messaging.InternalCordaRPCOps import net.corda.core.messaging.CordaRPCOps import net.corda.core.internal.utilities.InvocationHandlerTemplate +import net.corda.core.messaging.FlowHandleWithClientId import net.corda.node.services.rpc.RpcAuthContext import net.corda.node.services.rpc.rpcContext import java.lang.reflect.Method @@ -32,6 +33,16 @@ internal class AuthenticatedRpcOpsProxy(private val delegate: InternalCordaRPCOp delegate.startTrackedFlowDynamic(logicType, *args) } + // Need overriding to pass additional `listOf(logicType)` argument for polymorphic `startFlow` permissions. + @Suppress("SpreadOperator") + override fun startFlowDynamicWithClientId( + clientId: String, + logicType: Class>, + vararg args: Any? + ): FlowHandleWithClientId = guard("startFlowDynamic", listOf(logicType), ::rpcContext) { + delegate.startFlowDynamicWithClientId(clientId, logicType, *args) + } + private companion object { private fun proxy(delegate: InternalCordaRPCOps, context: () -> RpcAuthContext): InternalCordaRPCOps { val handler = PermissionsEnforcingInvocationHandler(delegate, context)