Skip to content

[GR-57827] Move the initialization of security providers from build time to run time and place it behind the --future-defaults flag. #10143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 7, 2025

Conversation

graalvmbot
Copy link
Collaborator

@graalvmbot graalvmbot commented Nov 22, 2024

Motivation:
Currently, security providers are initialized at build time, which leads to several unwanted side effects, such as pulling unnecessary objects into the image heap and snapshotting values from the builder's JVM... (see #8674 and #5950). The only aspect related to the provider that still needs to happen at build time is provider verification. Since we can now initialize a class twice in Native Image (once at build time and again at run time), this gives us the opportunity to move their initialization to run time.

Code Walkthrough:

  • Remove fields that were holding provider objects in the image heap (and thus initialized at build time). Move all JDK providers (that can be moved) to runtime initialization (see SecurityServicesFeature.java).
  • Allow the loading of security providers via the service loading mechanism (see ServiceLoaderFeature.java).
  • Use a separate structure to support provider verification (see SecurityProvidersSupport), avoiding the need to keep provider objects in the image heap (see SecuritySubstitutions).
  • Allow the instantiation of the security provider at run-time by modifying substitutions in SecuritySubstitutions.
  • Remove the build-time initialization of XMLDSigRI from TrustStoreManager.
  • Update SecurityServiceTest to align with the new changes.
  • Add a CHANGELOG.md entry.

Note: The feature is now hidden behind the --future-defaults=all or --future-defaults=run-time-initialized-jdk flag (take a look here for more details).

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 22, 2024
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch 5 times, most recently from 34af8ac to 6456842 Compare December 3, 2024 09:05
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch from 6456842 to 7dcb3a1 Compare December 4, 2024 11:46
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch from 7dcb3a1 to 032d899 Compare December 25, 2024 07:14
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch 3 times, most recently from 89ff8f9 to 123c4d4 Compare January 15, 2025 08:24
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch 2 times, most recently from 7b5e4ab to 945f038 Compare January 23, 2025 13:01
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch from 945f038 to d9b4f9d Compare February 19, 2025 09:18
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch from d9b4f9d to 8c19084 Compare March 5, 2025 14:27
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch from 8c19084 to cabc6c2 Compare March 25, 2025 13:02
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch from cabc6c2 to 3c93db2 Compare April 2, 2025 09:54
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch from 3c93db2 to 6fa2f31 Compare April 14, 2025 08:32
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch 2 times, most recently from a96aec3 to 32501d8 Compare May 20, 2025 13:01
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch 4 times, most recently from f7b5c08 to a36a031 Compare May 29, 2025 14:09
@graalvmbot graalvmbot changed the title [GR-57827] Initialize security providers at run time. [WIP][GR-57827] Initialize security providers at run time. May 29, 2025
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch from a36a031 to 9884742 Compare May 29, 2025 15:20
@graalvmbot graalvmbot changed the title [WIP][GR-57827] Initialize security providers at run time. [GR-57827] Initialize security providers at run time. May 30, 2025
@graalvmbot graalvmbot changed the title [GR-57827] Initialize security providers at run time. [GR-57827] Move the initialization of security providers from build time to run time and place it behind the --future-defaults flag. May 30, 2025
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch 2 times, most recently from 5e20e93 to 1883add Compare June 5, 2025 19:06
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch 3 times, most recently from b59fc06 to f98245e Compare June 6, 2025 12:55
jovanstevanovic and others added 4 commits June 7, 2025 15:29
…efaults flags.

Add a test for security provider run time registration.

Add entry to a CHANGELOG.md

Parse java.security.properties file at run time.
@graalvmbot graalvmbot force-pushed the js/GR-57827/providers-in-build-time branch from f98245e to af69098 Compare June 7, 2025 13:34
@graalvmbot graalvmbot merged commit bd3008c into master Jun 7, 2025
13 checks passed
@graalvmbot graalvmbot deleted the js/GR-57827/providers-in-build-time branch June 7, 2025 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants