mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 23:23:37 +01:00
[PR #1198] [MERGED] Fixed fallback certificates not working in certain classloader setups #937
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/1198
Author: @netvl
Created: 9/4/2025
Status: ✅ Merged
Merged: 9/5/2025
Merged by: @bioball
Base:
main← Head:ca-classloading-fix📝 Commits (1)
e35c104Fixed fallback certificates not working in certain classloader setups📊 Changes
1 file changed (+3 additions, -2 deletions)
View changed files
📝
pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliCommand.kt(+3 -2)📄 Description
In the original implementation the
org/pkl/commons/cli/PklCARoots.pemresource is resolved relatively to the classloader associated with the class returned byjavaClass. However, since this is an extension method forHttpClient.Builder, it means callingjavaClasson the builder instance, which is actually defined in the system classpath.Because of this, if the Pkl class is loaded by a different classloader compared to the one which contains JDK classes, which is totally possible in certain scenarios (e.g. with Gradle), then this resource resolution will fail.
The solution is to resolve
javaClassagainstthis@CliCommand, to use the classloader which loaded the jar with theCliCommandclass to find the CA resource.Closes https://github.com/apple/pkl/issues/1199
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.