ENT-1564 - add additional uploader check to the HashConstraint (#2845) (#2881)

* ENT-1564 - add additional uploader check to the HashConstraint (#2845)

(cherry picked from commit 1a1cd94)

* ENT-1564 changelog entry

* ENT-1564 ignored tests that were removed in master
This commit is contained in:
Tudor Malene
2018-03-27 17:09:22 +01:00
committed by Katelyn Baker
parent 190232d1f2
commit de40d1dae5
5 changed files with 21 additions and 4 deletions

View File

@ -3,7 +3,7 @@ package net.corda.nodeapi.internal
import net.corda.core.contracts.Attachment
import net.corda.core.contracts.ContractAttachment
import net.corda.core.crypto.SecureHash
import net.corda.core.internal.DEPLOYED_CORDAPP_UPLOADER
import net.corda.core.internal.isUploaderTrusted
import net.corda.core.serialization.CordaSerializable
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
@ -33,7 +33,7 @@ class AttachmentsClassLoader(attachments: List<Attachment>, parent: ClassLoader
}
init {
require(attachments.mapNotNull { it as? ContractAttachment }.none { it.uploader != DEPLOYED_CORDAPP_UPLOADER }) {
require(attachments.mapNotNull { it as? ContractAttachment }.all { isUploaderTrusted(it.uploader) }) {
"Attempting to load Contract Attachments downloaded from the network"
}