From e859d8067b7c17ae159ae6a79e7baa5554cf64e7 Mon Sep 17 00:00:00 2001 From: Michael Eichhorn Date: Mon, 20 Jul 2026 12:46:30 +0200 Subject: [PATCH 1/4] TS-41035 modified Exception catch to only send the PID --- .../jacoco/agent/configuration/ProcessInformationRetriever.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt b/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt index 4ad524ce7..db29f1e20 100644 --- a/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt +++ b/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt @@ -50,7 +50,8 @@ class ProcessInformationRetriever(private val logger: ILogger) { val pid = processHandleClass.getMethod("pid").invoke(processHandle) as Long return pid.toString() } catch (_: ReflectiveOperationException) { - return ManagementFactory.getRuntimeMXBean().name + // getRunTimeMXBean().name returns 'pid@hostname' + return ManagementFactory.getRuntimeMXBean().name.split('@')[0] } } } From 77ff13b92bb45b3252ab4f65d4d1bfaaab8472fe Mon Sep 17 00:00:00 2001 From: Michael Eichhorn Date: Mon, 20 Jul 2026 12:59:18 +0200 Subject: [PATCH 2/4] TS-41035 small durability adjustment + changelog --- CHANGELOG.md | 1 + .../agent/configuration/ProcessInformationRetriever.kt | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d187fc38..3192d49d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ We use [semantic versioning](http://semver.org/): # Next version - [security fix] _agent_: The Azure shared-key error messages no longer include the configured `azure-key` value in the exception text (previously leaked the access key into stack traces and logs) +- [fix] _agent_: In some cases the hostname was wrongly added to the PID when sending it to Teamscale. # 37.0.0 - [security fix] _agent_: Removed embedded Jetty addressing CVE-2026-2332, CVE-2024-6763 diff --git a/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt b/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt index db29f1e20..a3d7a1d39 100644 --- a/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt +++ b/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt @@ -51,7 +51,11 @@ class ProcessInformationRetriever(private val logger: ILogger) { return pid.toString() } catch (_: ReflectiveOperationException) { // getRunTimeMXBean().name returns 'pid@hostname' - return ManagementFactory.getRuntimeMXBean().name.split('@')[0] + val res = ManagementFactory.getRuntimeMXBean().name + if (res.contains('@')){ + return res.split('@')[0] + } + return res } } } From accb5f54136e745a5916c5b836d40abef59f1660 Mon Sep 17 00:00:00 2001 From: Michael Eichhorn Date: Tue, 21 Jul 2026 09:33:30 +0200 Subject: [PATCH 3/4] TS-41035 rework --- .../agent/configuration/ProcessInformationRetriever.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt b/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt index a3d7a1d39..a9e2155da 100644 --- a/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt +++ b/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt @@ -52,10 +52,7 @@ class ProcessInformationRetriever(private val logger: ILogger) { } catch (_: ReflectiveOperationException) { // getRunTimeMXBean().name returns 'pid@hostname' val res = ManagementFactory.getRuntimeMXBean().name - if (res.contains('@')){ - return res.split('@')[0] - } - return res + return res.substringBefore('@') } } } From e507e1938c6a237a650bcf3f7057c9cf09f97d94 Mon Sep 17 00:00:00 2001 From: Michael Eichhorn Date: Tue, 21 Jul 2026 10:11:50 +0200 Subject: [PATCH 4/4] TS-41035 changelog changes --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5326c6ebc..4e8d7a030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,11 @@ We use [semantic versioning](http://semver.org/): - PATCH version when you make backwards compatible bug fixes. # Next version +- [fix] _agent_: In some cases the hostname was wrongly added to the PID when sending it to Teamscale. # 37.0.1 - [fix] _agent_: Changed testwise coverage mode to log a warning and finalize an interrupted test as `SKIPPED` (with a calculated duration) if a new test started before the previous `/test/end` event arrived. - [security fix] _agent_: The Azure shared-key error messages no longer include the configured `azure-key` value in the exception text (previously leaked the access key into stack traces and logs) -- [fix] _agent_: In some cases the hostname was wrongly added to the PID when sending it to Teamscale. # 37.0.0 - [security fix] _agent_: Removed embedded Jetty addressing CVE-2026-2332, CVE-2024-6763