Skip to content

Commit

Permalink
fix(tls): return empty list if custom truststore dir is not accessible (
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores authored Apr 26, 2024
1 parent c634cdd commit 12b97bf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/io/cryostat/security/TrustStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public class TrustStore {
@Path("/api/v3/tls/certs")
@Produces(MediaType.APPLICATION_JSON)
public List<String> listCerts() throws IOException {
var accessible =
Files.exists(trustStoreDir)
&& Files.isDirectory(trustStoreDir)
&& Files.isReadable(trustStoreDir)
&& Files.isExecutable(trustStoreDir);
if (!accessible) {
return List.of();
}
return Files.walk(trustStoreDir)
.map(java.nio.file.Path::toFile)
.filter(File::isFile)
Expand Down

0 comments on commit 12b97bf

Please sign in to comment.