diff --git a/client/trino-client/src/main/java/io/trino/client/auth/kerberos/LoginBasedSubjectProvider.java b/client/trino-client/src/main/java/io/trino/client/auth/kerberos/LoginBasedSubjectProvider.java index 36ac34875486..0e27a1c013fc 100644 --- a/client/trino-client/src/main/java/io/trino/client/auth/kerberos/LoginBasedSubjectProvider.java +++ b/client/trino-client/src/main/java/io/trino/client/auth/kerberos/LoginBasedSubjectProvider.java @@ -61,6 +61,11 @@ public LoginBasedSubjectProvider( "Refusing to set system property 'java.security.krb5.conf' to '%s', it is already set to '%s'", newValue, currentValue); + checkState( + file.exists() && !file.isDirectory(), + "Kerberos config file '%s' does not exist or is a directory", + newValue); + checkState(file.canRead(), "Kerberos config file '%s' is not readable", newValue); System.setProperty("java.security.krb5.conf", newValue); }); }