Skip to content

Commit ccfb3a1

Browse files
authored
Merge pull request #135 from Fraunhofer-AISEC/release/7.1.0
Release 7.1.0
2 parents 167f674 + 22f70cc commit ccfb3a1

File tree

7 files changed

+26
-32
lines changed

7 files changed

+26
-32
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version: 2
12
updates:
23
- package-ecosystem: "npm"
34
directory: "/"

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ licenseReport {
2525

2626
allprojects {
2727
group = "de.fhg.aisec.ids"
28-
version = "7.0.0"
28+
version = "7.1.0"
2929

30-
val versionRegex = ".*(rc-?[0-9]*|beta)$".toRegex(RegexOption.IGNORE_CASE)
30+
val versionRegex = ".*(rc-?[0-9]*|beta|-b.+)$".toRegex(RegexOption.IGNORE_CASE)
3131

3232
tasks.withType<DependencyUpdatesTask> {
3333
rejectVersionIf {

camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/multipart/CertExposingHttpClientConfigurer.kt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
*/
2020
package de.fhg.aisec.ids.camel.processors.multipart
2121

22-
import com.google.common.collect.MapMaker
23-
import de.fhg.aisec.ids.idscp2.daps.aisecdaps.AisecDapsDriver.Companion.toHexString
22+
import de.fhg.aisec.ids.idscp2.api.sha256Fingerprint
2423
import org.apache.camel.component.http.HttpClientConfigurer
2524
import org.apache.http.HttpResponse
2625
import org.apache.http.conn.ManagedHttpClientConnection
@@ -29,8 +28,6 @@ import org.apache.http.protocol.HttpCoreContext
2928
import org.slf4j.Logger
3029
import org.slf4j.LoggerFactory
3130
import org.springframework.stereotype.Component
32-
import java.security.MessageDigest
33-
import java.security.cert.Certificate
3431

3532
@Component("certExposingHttpClientConfigurer")
3633
class CertExposingHttpClientConfigurer : HttpClientConfigurer {
@@ -39,11 +36,10 @@ class CertExposingHttpClientConfigurer : HttpClientConfigurer {
3936
val routedConnection = context.getAttribute(HttpCoreContext.HTTP_CONNECTION) as ManagedHttpClientConnection
4037
routedConnection.sslSession?.let { sslSession ->
4138
val certs = sslSession.peerCertificates
42-
val certHash = MessageDigest.getInstance("SHA-256").digest(certs[0].encoded).toHexString().lowercase()
43-
certificateMap += certHash to certs
39+
val certHash = certs[0].sha256Fingerprint
4440
response.setHeader(SERVER_CERTIFICATE_HASH_HEADER, certHash)
4541
if (LOG.isDebugEnabled) {
46-
LOG.debug("Captured server certificate with SHA256 fingerprint $certHash.")
42+
LOG.debug("Observed server certificate with SHA256 fingerprint $certHash.")
4743
}
4844
}
4945
}
@@ -52,6 +48,5 @@ class CertExposingHttpClientConfigurer : HttpClientConfigurer {
5248
companion object {
5349
val LOG: Logger = LoggerFactory.getLogger(CertExposingHttpClientConfigurer::class.java)
5450
const val SERVER_CERTIFICATE_HASH_HEADER = "ServerCertificateHash"
55-
val certificateMap: MutableMap<String, Array<Certificate>> = MapMaker().weakKeys().makeMap()
5651
}
5752
}

camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/multipart/IdsMultiPartInputProcessor.kt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package de.fhg.aisec.ids.camel.processors.multipart
2222
import de.fhg.aisec.ids.api.contracts.ContractUtils.SERIALIZER
2323
import de.fhg.aisec.ids.camel.processors.UsageControlMaps
2424
import de.fhg.aisec.ids.idscp2.api.drivers.DapsDriver
25+
import de.fhg.aisec.ids.idscp2.api.sha256Fingerprint
2526
import de.fraunhofer.iais.eis.Message
2627
import org.apache.camel.Exchange
2728
import org.apache.camel.Processor
@@ -33,8 +34,6 @@ import org.springframework.beans.factory.annotation.Autowired
3334
import org.springframework.beans.factory.annotation.Value
3435
import org.springframework.stereotype.Component
3536
import java.io.InputStream
36-
import java.security.cert.Certificate
37-
import java.security.cert.X509Certificate
3837
import javax.net.ssl.SSLPeerUnverifiedException
3938
import javax.net.ssl.SSLSession
4039

@@ -62,32 +61,31 @@ class IdsMultiPartInputProcessor : Processor {
6261
val dat = idsHeader.securityToken?.tokenValue ?: throw RuntimeException("No DAT provided!")
6362

6463
dapsBeanName?.let { dapsBeanName ->
65-
val peerCertificates: Array<Certificate> = if (message.headers.containsKey("CamelHttpServletRequest")) {
64+
val peerCertificateHash: String = if (message.headers.containsKey("CamelHttpServletRequest")) {
6665
// Assume server-side REST endpoint.
6766
// Try to extract certificates from CamelHttpServletRequest reference.
6867
val request = message.headers["CamelHttpServletRequest"] as Request
6968
val sslSession = request.getAttribute("org.eclipse.jetty.servlet.request.ssl_session") as SSLSession
7069
try {
71-
sslSession.peerCertificates
70+
sslSession.peerCertificates[0].sha256Fingerprint
7271
} catch (e: SSLPeerUnverifiedException) {
7372
LOG.error("Client didn't provide a certificate!")
7473
throw e
7574
}
7675
} else {
7776
// Assume client-side HTTPS request.
78-
// Try to obtain Certificates extracted by CertExposingHttpClientConfigurer.
79-
message.headers[CertExposingHttpClientConfigurer.SERVER_CERTIFICATE_HASH_HEADER]?.let { hash ->
80-
CertExposingHttpClientConfigurer.certificateMap[hash]
81-
} ?: throw RuntimeException(
82-
"Could not obtain server TLS certificate! Has CertExposingHttpClientConfigurer been invoked?"
83-
)
77+
// Try to obtain Certificate hash extracted by CertExposingHttpClientConfigurer.
78+
message.headers[CertExposingHttpClientConfigurer.SERVER_CERTIFICATE_HASH_HEADER]?.toString()
79+
?: throw RuntimeException(
80+
"Could not obtain server TLS certificate! Has CertExposingHttpClientConfigurer been invoked?"
81+
)
8482
}
8583
if (LOG.isTraceEnabled) {
86-
LOG.trace("Peer Certificates: {}", peerCertificates)
84+
LOG.trace("Peer Certificate hash: {}", peerCertificateHash)
8785
}
8886
val daps = beanFactory.getBean(dapsBeanName, DapsDriver::class.java)
8987
try {
90-
val verifiedDat = daps.verifyToken(dat.toByteArray(), peerCertificates[0] as X509Certificate)
88+
val verifiedDat = daps.verifyToken(dat.toByteArray(), peerCertificateHash)
9189
// Save exchange peer identity for contract association
9290
UsageControlMaps.setExchangePeerIdentity(exchange, verifiedDat.identity)
9391
// Save effective transfer contract for peer

camel-processors/src/main/kotlin/de/fhg/aisec/ids/idscp2/beans/AisecDapsDriverFactoryBean.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
package de.fhg.aisec.ids.idscp2.beans
2121

22-
import de.fhg.aisec.ids.camel.idscp2.Idscp2Endpoint.Companion.applySslContextParameters
22+
import de.fhg.aisec.ids.camel.idscp2.applySslContextParameters
2323
import de.fhg.aisec.ids.idscp2.daps.aisecdaps.AisecDapsDriver
2424
import de.fhg.aisec.ids.idscp2.daps.aisecdaps.AisecDapsDriverConfig
2525
import de.fhg.aisec.ids.idscp2.daps.aisecdaps.SecurityRequirements
@@ -60,7 +60,7 @@ class AisecDapsDriverFactoryBean : FactoryBean<AisecDapsDriver> {
6060

6161
var dapsSslParameters: SSLContextParameters
6262
set(value) {
63-
applySslContextParameters(builder, value)
63+
builder.applySslContextParameters(value)
6464
}
6565
get() = throw UnsupportedOperationException("set-only Builder method")
6666

camel-processors/src/main/kotlin/de/fhg/aisec/ids/idscp2/beans/NativeTlsConfigurationBuilderFactoryBean.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
package de.fhg.aisec.ids.idscp2.beans
2121

22-
import de.fhg.aisec.ids.camel.idscp2.Idscp2Endpoint
22+
import de.fhg.aisec.ids.camel.idscp2.applySslContextParameters
2323
import de.fhg.aisec.ids.idscp2.defaultdrivers.securechannel.tls13.NativeTlsConfiguration
2424
import org.apache.camel.support.jsse.SSLContextParameters
2525
import org.springframework.beans.factory.FactoryBean
@@ -31,7 +31,7 @@ class NativeTlsConfigurationBuilderFactoryBean : FactoryBean<NativeTlsConfigurat
3131

3232
var sslParameters: SSLContextParameters
3333
set(value) {
34-
Idscp2Endpoint.applySslContextParameters(builder, value)
34+
builder.applySslContextParameters(value)
3535
}
3636
get() = throw UnsupportedOperationException("set-only Builder method")
3737

gradle/libs.versions.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[versions]
2-
idscp2 = "0.16.1"
2+
idscp2 = "0.17.0"
33
ktlint = "0.48.2"
44

55
# Kotlin library/compiler version
66
kotlin = "1.8.0"
77
kotlinxCoroutines = "1.6.4"
88
# HTTP client
9-
ktor = "2.2.2"
9+
ktor = "2.2.3"
1010

1111
# The used version of the infomodel from IESE
1212
infomodel = "4.1.3"
@@ -23,7 +23,7 @@ influxDB = "2.23"
2323
guava = "31.1-jre"
2424
junit4 = "4.13.2"
2525
junit5 = "5.9.2"
26-
mockito = "5.0.0"
26+
mockito = "5.1.1"
2727
mapdb = "3.0.9"
2828
jnrunix = "0.38.19"
2929
protobuf = "3.21.12"
@@ -43,8 +43,8 @@ javaxJson = "1.1.4"
4343
dockerJavaApi = "0.0.13"
4444

4545
# We will pull in a newer version of jackson because of security fixes
46-
jackson = "2.14.1"
47-
jacksonDatabind = "2.14.1"
46+
jackson = "2.14.2"
47+
jacksonDatabind = "2.14.2"
4848

4949
orgJson = "20220320"
5050

@@ -160,6 +160,6 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
160160
kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
161161
spotless = { id = "com.diffplug.spotless", version = "6.14.0" }
162162
licenseReport = { id = "com.github.jk1.dependency-license-report", version = "2.1" }
163-
versions = { id = "com.github.ben-manes.versions", version = "0.44.0" }
163+
versions = { id = "com.github.ben-manes.versions", version = "0.45.0" }
164164
buildconfig = { id = "com.github.gmazzo.buildconfig", version = "3.1.0" }
165165
node = { id = "com.github.node-gradle.node", version = "3.5.1" }

0 commit comments

Comments
 (0)