Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ebd446b
Avoid accidental security provider inclusion
vjovanov Jun 19, 2026
b269a9c
[GR-69858] Fix security provider verification cache
vjovanov Jun 19, 2026
28c60fe
[GR-69858] Preserve explicit security provider metadata
vjovanov Jun 20, 2026
385d297
[GR-69858] Remove security provider troubleshooting section
vjovanov Jun 20, 2026
5cfaff4
[GR-69858] Remove deprecated provider option docs
vjovanov Jun 20, 2026
82fac2e
[GR-69858] Use reflection lookup for service-loaded providers
vjovanov Jun 20, 2026
d2ef2d4
[GR-69858] Trace security provider lookups in the agent
vjovanov Jun 20, 2026
d625be8
[GR-69858] Trace security provider lookups natively
vjovanov Jun 20, 2026
22530f0
[GR-69858] Fix security provider gate failures
vjovanov Jun 21, 2026
b639817
Fix exact metadata handling for SunEC provider
vjovanov Jun 21, 2026
5defc77
[GR-69858] Gate provider inclusion on reflection metadata
vjovanov Jun 29, 2026
4be22a0
[GR-69858] Allow security provider support in layered builds
vjovanov Jun 30, 2026
4d16591
Fix the missing metadata entry for the provider
vjovanov Jul 3, 2026
aa7db56
[GR-69858] Preserve service-driven security providers
vjovanov Jul 3, 2026
edbbb5c
[GR-69858] Use standard reflection errors for providers
vjovanov Jul 3, 2026
3f55c05
[GR-69858] Preserve GSS provider services
vjovanov Jul 3, 2026
c9537b8
[GR-69858] Preserve concurrent JNI registrations
vjovanov Jul 4, 2026
3833fd5
[GR-69858] Preserve concurrent negative JNI registrations
vjovanov Jul 15, 2026
7ef005e
[GR-69858] Fix GSS reachability registration
vjovanov Jul 20, 2026
0ee92cd
[GR-69858] Gate service-driven providers on metadata
vjovanov Jul 20, 2026
ae8627f
Revert "[GR-69858] Preserve concurrent JNI registrations"
vjovanov Jul 20, 2026
d85fb1f
[GR-69858] Reprocess late security provider candidates
vjovanov Jul 20, 2026
aaec468
[GR-69858] Defer provider candidate reprocessing
vjovanov Jul 20, 2026
9005d8c
[GR-69858] Document security provider metadata behavior
vjovanov Jul 21, 2026
5d3d0f9
[GR-69858] Fix security provider future default
vjovanov Jul 21, 2026
9c4662d
[GR-69858] Migrate security provider tests to metadata
vjovanov Jul 21, 2026
de7f7b1
[GR-69858] Specify security provider behavior
vjovanov Jul 21, 2026
363f77b
[GR-69858] Tighten security provider specification
vjovanov Jul 22, 2026
e988b12
[GR-69858] Preserve complete default SecureRandom provider
vjovanov Jul 23, 2026
46ab998
[GR-69858] Require explicit security provider reflection metadata
vjovanov Jul 23, 2026
5f44984
[GR-69858] Fix security provider Javadoc links
vjovanov Jul 23, 2026
a668e85
[GR-69858] Validate grund references in Checkstyle
vjovanov Jul 23, 2026
3a289e6
GR-69858: Support reflective security providers
vjovanov Jul 24, 2026
f1d5462
GR-69858: Revert unnecessary JNI access changes
vjovanov Jul 24, 2026
5350d93
GR-69858: Complete security provider registration handling
vjovanov Jul 24, 2026
c8745d1
GR-69858: Fix security provider tracing regressions
vjovanov Jul 24, 2026
82a8870
GR-69858: Fix security provider agent tracing
vjovanov Jul 25, 2026
f11af0f
Fix security provider tracing metadata
vjovanov Jul 26, 2026
f823d5c
GR-69858: Refactor security provider architecture
vjovanov Jul 26, 2026
2b4edd1
GR-69858: Avoid reassigning security provider parameter
vjovanov Jul 26, 2026
fa2bf8f
[GR-69858] Fix reflection usage exclusions
vjovanov Jul 27, 2026
c58f4af
[GR-69858] Refine security provider registration
vjovanov Jul 27, 2026
181210c
GR-69858: Complete security provider fixes
vjovanov Jul 27, 2026
c940f86
GR-69858: Address security provider review feedback
vjovanov Jul 27, 2026
efcba17
GR-69858: Fix security provider CI regressions
vjovanov Jul 27, 2026
97c7c1d
[GR-69858] Preserve application provider verification metadata
vjovanov Jul 27, 2026
549d863
Make explicit provider registration imply runtime initialization
vjovanov Jul 27, 2026
5108249
GR-69858: Refine security provider reflection tracing
vjovanov Jul 28, 2026
91b30ed
GR-69858: Fix security provider review findings
vjovanov Jul 28, 2026
b0958db
GR-69858: Move hosted security provider support to JCA package
vjovanov Jul 28, 2026
4284bcb
GR-69858: Fix security provider gate failures
vjovanov Jul 28, 2026
50ddf6a
GR-69858: Fix layered provider verification cache
vjovanov Jul 29, 2026
92f3dea
GR-69858: Fix security service native test options
vjovanov Jul 29, 2026
7457c87
GR-69858: Preserve application provider verification
vjovanov Jul 29, 2026
444165d
GR-69858: Conditionally register security provider construction
vjovanov Jul 30, 2026
495ab41
GR-69858: Scope provider construction registration to selection
vjovanov Jul 30, 2026
6b2d18e
GR-69858: Support JCE callers and duplicate provider names
vjovanov Jul 31, 2026
e1748fa
GR-69858: Trace cached security provider services
vjovanov Aug 3, 2026
2676d9d
Fix Eclipse formatting
vjovanov Aug 4, 2026
e070c88
GR-69858: Trace selected JCE service implementations
vjovanov Aug 5, 2026
48d7cde
GR-69858: Trace native provider list mutation
vjovanov Aug 6, 2026
19aac29
GR-69858: Retain native provider construction tracing
vjovanov Aug 7, 2026
5aa2831
GR-69858: Trace selected provider services
vjovanov Aug 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static void createOptionsDescriptorsFile(ProcessingEnvironment processingEnv, Op
out.printf(" /*fieldName*/ \"%s\",\n", fieldName);
out.printf(" /*stability*/ %s.%s,\n", getSimpleName(OPTION_STABILITY_CLASS_NAME), stability);
out.printf(" /*deprecated*/ %b,\n", deprecated);
out.printf(" /*deprecationMessage*/ \"%s\");\n", deprecationMessage);
out.printf(" /*deprecationMessage*/ %s);\n", literal(deprecationMessage));
out.println(" }");
}
out.println(" // CheckStyle: resume line length check");
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-manual/native-image/BuildOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ These deprecated URL protocol options are omitted from the generated table; see
| `--exact-reachability-metadata` | String | enables exact and user-friendly handling of reflection, resources, JNI, and serialization. | | `--exact-reachability-metadata=exact-reachability-metadata` |
| `--exact-reachability-metadata-path` | String | trigger exact handling of reflection, resources, JNI, and serialization from all types in the given class-path or module-path entries. | None | `--exact-reachability-metadata-path=exact-reachability-metadata-path` |
| `--features` | String | a comma-separated list of fully qualified Feature implementation classes | None | `--features=features` |
| `--future-defaults` | String | enable options that are planned to become defaults in future releases. Comma-separated list can contain 'all', 'none', 'run-time-initialize-jdk', 'class-for-name-respects-class-loader', 'run-time-initialize-file-system-providers', 'run-time-initialize-security-providers', 'run-time-initialize-resource-bundles', 'explicit-feature-singleton-registration'. The preferred usage is '--future-defaults=all'. | <default-value> | `--future-defaults=future-defaults` |
| `--future-defaults` | String | enable options that are planned to become defaults in future releases. Comma-separated list can contain 'all', 'none', 'run-time-initialize-jdk', 'class-for-name-respects-class-loader', 'run-time-initialize-file-system-providers', 'run-time-initialize-security-providers', 'run-time-initialize-resource-bundles', 'explicit-feature-singleton-registration', 'explicit-security-provider-registration', 'exact-reflection'. The preferred usage is '--future-defaults=all'. | <default-value> | `--future-defaults=future-defaults` |
| `--initialize-at-build-time` | String | a comma-separated list of packages and classes (and implicitly all of their superclasses) that are initialized during image generation. An empty string designates all packages. | | `--initialize-at-build-time=initialize-at-build-time` |
| `--initialize-at-run-time` | String | a comma-separated list of packages and classes (and implicitly all of their subclasses) that must be initialized at runtime and not during image building. An empty string is currently not supported. | | `--initialize-at-run-time=initialize-at-run-time` |
| `--libc` | String | selects the libc implementation to use. Available implementations: glibc, musl, bionic | None | `--libc=libc` |
Expand Down
52 changes: 42 additions & 10 deletions docs/reference-manual/native-image/JCASecurityServices.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,40 @@ By default the `native-image` builder uses static analysis to discover which of
The automatic registration of security services can be disabled with `-H:-EnableSecurityServicesFeature`.
Then a custom reflection configuration file or feature can be used to register the security services required by a specific application.
Note that when automatic registration of security providers is disabled, all providers are, by default, filtered from special JDK caches that are necessary for security functionality.
In this case, you must manually mark used providers with `-H:AdditionalSecurityProviders`.
In this case, register the provider class and its nullary constructor for reflection in _reachability-metadata.json_, for example:

```json
{
"reflection": [
{
"type": "com.example.security.CustomProvider",
"methods": [
{
"name": "<init>",
"parameterTypes": []
}
]
}
]
}
```

Alternatively, collect the metadata by running your application on the JVM with the [Tracing Agent](AutomaticMetadataCollection.md).

## Security Services Automatic Registration

The mechanism, implemented in the `com.oracle.svm.hosted.SecurityServicesFeature` class, uses reachability of specific API methods in the JCA framework to determine which security services are used.
The mechanism, implemented in the `com.oracle.svm.hosted.jca.SecurityServicesFeature` class, uses reachability of specific API methods in the JCA framework to determine which security services are used.

Each JCA provider registers concrete implementation classes for the algorithms it supports.
Each of the service classes (`Signature`, `Cipher`, `Mac`, `KeyPair`, `KeyGenerator`, `KeyFactory`, `KeyStore`, etc.) declares a series of `getInstance(<algorithm>, <provider>` factory methods which provide a concrete service implementation.
When a specific algorithm is requested, the framework searches the registered providers for the corresponding implementation classes and dynamically allocates objects for concrete service implementations.
The `native-image` builder uses static analysis to discover which of these services are used.
It does so by registering reachability handlers for each of the `getInstance()` factory methods.
When it determines that a `getInstance()` method is reachable at run time, it automatically performs the reflection registration for all the concrete implementations of the corresponding service type.
Provider classes discovered as reachable subtypes of `java.security.Provider` are treated only as candidates for provider inclusion.
The builder includes such a provider and all of its services only when the provider class is registered for reflection, either by type access, its declared nullary constructor, or its static `provider()` method.
To apply this reflection requirement to providers selected by reachable service factories, use `--future-defaults=explicit-security-provider-registration`.
With this future default, a factory does not make an unregistered provider or its services available.

Tracing of the security services automatic registration can be enabled with `-H:+TraceSecurityServices`.
The report will detail all registered service classes, the API methods that triggered registration, and the parsing context for each reachable API method.
Expand All @@ -40,7 +62,8 @@ The report will detail all registered service classes, the API methods that trig

Currently, security providers are initialized at build time.
To move their initialization to run time, use the option `--future-defaults=run-time-initialize-security-providers`, `--future-defaults=all`, or `--future-defaults=run-time-initialize-jdk`.
Provider verification will still occur at build time.
Providers listed in the build-time `java.security` configuration are still verified at build time.
Providers included only through reflection metadata are treated as explicitly configured, since run-time codebase verification is not available in Native Image.
Run-time initialization of security providers helps reduce image heap size.

## Provider Registration
Expand All @@ -65,17 +88,26 @@ The same approach to manipulating providers can then be used.

## SecureRandom

The `SecureRandom` implementations open the `/dev/random` and `/dev/urandom` files which are used as sources.
These files are usually opened in class initializers.
To avoid capturing state from the machine that runs the `native-image` builder, these classes need to be initialized at run time.
Native Image initializes `NativePRNG`, its seed generators, and related entropy-holding classes at
run time.
This prevents `/dev/random`, `/dev/urandom`, and machine-specific seed state from being captured
on the image builder.
Class-initialization safety is separate from provider registration: a reachable `SecureRandom`
acquisition also triggers registration of the complete configured-provider set that declares
`SecureRandom` services.

## Custom Service Types

By default, only services specified in the JCA framework are automatically registered. To automatically register custom service types, you can use the `-H:AdditionalSecurityServiceTypes` option.
Note that for automatic registration to work, the service interface must have a `getInstance` method and have the same name as the service type.
If relying on the third-party code that does not comply to the above requirements, a manual configuration will be required. In that case, providers for such services must explicitly be registered using the `-H:AdditionalSecurityProviders` option. Note that these options are only required in very specific cases and should not normally be needed.
By default, Native Image automatically detects only service types specified in the JCA framework.
The `-H:AdditionalSecurityServiceTypes` option is deprecated.
Register the provider class and its supported construction path in _reachability-metadata.json_ so
Native Image retains its complete service catalog, including custom service types.
Alternatively, collect this metadata with the Tracing Agent.
For compatibility with automatic service-driven registration, the service interface must have a
`getInstance` method and the same name as the service type.
If you rely on third-party code that does not comply with these requirements, manual configuration is required.

### Further Reading

* [URL Protocols in Native Image](URLProtocols.md)
* [Jipher JCE with Native Image](../../security/JipherJCE.md)
* [Jipher JCE with Native Image](../../security/JipherJCE.md)
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ Other handy options are `-H:+AddAllCharsets` to add charsets support, and `-H:+I
Pass those options at build time.
This might increase the size of the resulting binary.

### 4. Add Missing Security Providers

If your application is using Security Providers, try to pre-initialize security providers by passing the option `-H:AdditionalSecurityProviders=<list-of-providers>` at build time.
Here is a list of all JDK security providers to choose from:
`sun.security.provider.Sun,sun.security.rsa.SunRsaSign,sun.security.ec.SunEC,sun.security.ssl.SunJSSE,com.sun.crypto.provider.SunJCE,sun.security.jgss.SunProvider,com.sun.security.sasl.Provider,org.jcp.xml.dsig.internal.dom.XMLDSigRI,sun.security.smartcardio.SunPCSC,sun.security.provider.certpath.ldap.JdkLDAP,com.sun.security.sasl.gsskerb.JdkSASL`.

### 5. File a Native Image Run-Time Issue
### 4. File a Native Image Run-Time Issue

Only if you tried all the above suggestions, file a [Native Image Run-Time Issue Report](https://github.com/oracle/graal/issues/new?assignees=&labels=native-image%2Cbug%2Crun-time&projects=&template=1_1_native_image_run_time_bug_report.yml&title=%5BNative+Image%5D+) at GitHub, filling out the necessary information.

Expand Down
1 change: 1 addition & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This changelog summarizes major changes to GraalVM Native Image.
* (GR-77670) Chunk up digest generation for Native Image Layers, to allow for large layer files to be checked. This makes older layer files potentially incompabile with layers created after this change.
* (GR-73199) When native executables are built with `-H:-LegacyJavaOptionMode`, VM options are parsed only before the first `--` argument. Arguments after `--` are passed unchanged to the application main method. The legacy behavior remains unchanged.
* (GR-77977) Added control flow integrity options, available via `-H:CFI`. Indirect branches on AMD64 can be guarded with software-based checks that ensure that they land on valid targets. On AArch64, PAC is supported to protect return addresses on the stack.
* (GR-69858) Deprecated `-H:AdditionalSecurityProviders` and `-H:AdditionalSecurityServiceTypes`. Register each security provider class for reflection in `reachability-metadata.json` using `{"reflection":[{"type":"<fully-qualified-provider-class-name>"}]}` instead. The Tracing Agent generates this metadata automatically. When provider initialization occurs at run time, Native Image preserves a reachable `META-INF/services/java.security.Provider` descriptor even if its provider is not registered; iterating that entry reports the standard service-loading or missing-reflection error.

## GraalVM 25.2 (Internal Version 25.2.4)
* (GR-77358) Introduced compressed (32-bit) references, enabled by default. This generally improves memory usage and performance, but limits heap memory to 32 GB. Disable with `-H:-UseCompressedReferences`.
Expand Down
5 changes: 5 additions & 0 deletions substratevm/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ Consulting the CI configurations in ci/ci.jsonnet may help understand how `mx ga
## Project Terminus

- [Project Terminus](project-terminus.md): overview and design direction for self-hosting Native Image.

## Security Providers

- [JCA Security Provider Inclusion](functional-spec/security-providers.md): required provider inclusion and run-time behavior.
- [Security Provider Architecture](architecture/security-providers.md): provider inclusion, verification, and metadata tracing.
6 changes: 6 additions & 0 deletions substratevm/docs/architecture/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Architecture

This directory contains developer-facing architecture records for Native Image.

- [Security Provider Architecture](security-providers.md): provider inclusion, verification, and
metadata tracing ([§AR-security-providers](../../src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jca/SecurityServicesFeature.java)).
1 change: 1 addition & 0 deletions substratevm/docs/architecture/security-providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# AR-security-providers: [SecurityServicesFeature](../../src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jca/SecurityServicesFeature.java)
6 changes: 6 additions & 0 deletions substratevm/docs/functional-spec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Functional Specifications

This directory contains functional specifications for Native Image.

- [JCA Security Provider Inclusion](security-providers.md): provider lookup and factory-call behavior based on metadata.
- [Functional Decisions](decisions/): product behavior decisions and tradeoffs for the specifications.
9 changes: 9 additions & 0 deletions substratevm/docs/functional-spec/decisions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Functional Decisions

This directory contains product behavior decisions and tradeoffs for Native Image functional
specifications.

- [Register Providers as Complete Service Units](complete-security-provider-registration.md)
- [Retain the Complete Default Provider for SecureRandom](default-secure-random-provider.md)
- [Keep Run-Time Semantics Independent of Reachability](reachability-independent-runtime-semantics.md)
- [Preserve Standard JCA Semantics Without Provider-Specific Flags](standard-jca-semantics.md)
Loading