Inaccessible profile file (due to JVM security manager) blocks client creation #5754
Closed
1 task done
Labels
closed-for-staleness
feature-request
A feature should be added or improved.
p2
This is a standard priority issue
Describe the bug
Elasticsearch uses the JVM Security Manager to restrict the files to which it has access, and in particular will block access to files in
$HOME/.aws
by default. The v1 SDK (e.g. version1.12.270
) treats this as if the files do not exist, which is what we want, but the v2 SDK (e.g. version2.28.13
) apparently just fails if the Security Manager denies this access:Regression Issue
Expected Behavior
We expect
software.amazon.awssdk.profiles.ProfileFileLocation#resolveIfExists
to catch aSecurityException
and convert it intoOptional.empty()
. The API docs forjava.nio.file.Files#isRegularFile
andjava.nio.file.Files#isReadable
both explicitly mention the possibility of throwing aSecurityException
rather than just returningfalse
if the file is nonexistent or unreadable.Current Behavior
Instead
software.amazon.awssdk.profiles.ProfileFileLocation#resolveIfExists
does not catch any exceptions and instead treats aSecurityException
similar to any other failure.Stack trace is shown above.
Reproduction Steps
Somewhat tricky because it involves running the JVM with the Security Manager installed. If the description above is unclear then please let me know and I'll put more effort in here.
Possible Solution
Additional Information/Context
We are aware that the Security Manager is deprecated and will not be available in a future JDK version. We are working to replace it with an alternative implementation that will maintain the same protections, which we therefore expect to suffer the same problems.
AWS Java SDK version used
2.28.13
JDK version used
21+35-2513 (Oracle)
Operating System and version
Mac OS X 15.2 (aarch64)
The text was updated successfully, but these errors were encountered: