Skip to content

Load root certificates at image build time #1999

@christianwimmer

Description

@christianwimmer

The JDK ships a file with root certificates: lib/security/cacerts. The JDK TrustStoreManager is responsible for loading. If no system property is set explicitly, then the cacerts file of the JDK is loaded. But that can be overridden using system properties.

We have a few options how to handle that in a native image:

  1. Do not embed any root certificates into a native image. That means that the application needs to be shipped with a cacerts file, or the system properties must be used to locate certificates already installed on the system. I think that is a bad option though because it is difficult for users, and no certificates are available out-of-the-box without additional configuration.
  2. Embed the root certificates into the native image, but still at run time look at the system properties and allow certificates from an alternative location to be loaded.
  3. Embed the root certificates into the native image, and do not allow any different certificates to be loaded at run time.

The difference between option 2) and 3) from a security and usability perspective: In option 2) we treat security as something that can be configured at image run time. In option 3), we consider security as something that is fixed at image build time and therefore cannot be modified (explicitly or accidentally) at run time.

We believe that "immutable security" is a valuable feature of Native Image and therefore implement solution 3)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions