Skip to content

Commit 04cfff8

Browse files
committed
fix(k8sjks): Throw exception when no password is provided for JKS.
1 parent f700a6c commit 04cfff8

File tree

1 file changed

+8
-2
lines changed
  • kubernetes-orchestrator-extension/StoreTypes/K8SJKS

1 file changed

+8
-2
lines changed

kubernetes-orchestrator-extension/StoreTypes/K8SJKS/Store.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ public Pkcs12Store DeserializeRemoteCertificateStore(byte[] storeContents, strin
3838
var pkcs12StoreNew = storeBuilder.Build();
3939

4040
_logger.LogTrace("storePath: {Path}", storePath);
41-
_logger.LogTrace("storePassword: {Pass}",
42-
storePassword ?? "null"); //TODO: INSECURE - Remove this line, it is for debugging purposes only
41+
42+
if (string.IsNullOrEmpty(storePassword))
43+
{
44+
_logger.LogError("JKS store password is null or empty for store at path '{Path}'", storePath);
45+
throw new ArgumentException("JKS store password is null or empty");
46+
}
47+
48+
_logger.LogTrace("storePassword: {Pass}", storePassword.Replace("\n","\\n")); //TODO: INSECURE - Remove this line, it is for debugging purposes only
4349
// var hashedStorePassword = GetSha256Hash(storePassword);
4450
// _logger.LogTrace("hashedStorePassword: {Pass}", hashedStorePassword ?? "null");
4551

0 commit comments

Comments
 (0)