Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix | Remove clientKeyPassword from memory #1428

Merged
merged 2 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -2707,7 +2707,10 @@ private InetSocketAddress connectHelper(ServerPortPlaceHolder serverInfo, int ti
if (TDS.ENCRYPT_NOT_SUP != negotiatedEncryptionLevel) {
tdsChannel.enableSSL(serverInfo.getServerName(), serverInfo.getPortNumber(), clientCertificate, clientKey,
clientKeyPassword);
clientKeyPassword = "";
}

activeConnectionProperties.remove(SQLServerDriverStringProperty.CLIENT_KEY_PASSWORD.toString());

// We have successfully connected, now do the login. logon takes seconds timeout
executeCommand(new LogonCommand());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ public final class SQLServerXAConnection extends SQLServerPooledConnection imple
trustStorePassword);
}

// Add clientKeyPassword password property for creating the control connection. This will be removed again
// first check if clientCertificate is there to see if the clientKeyPassword was possibly provided
String clientCertificate = ds.getClientCertificate();
if (null != clientCertificate && clientCertificate.length() > 0) {
Properties urlProps = Util.parseUrl(ds.getURL(), xaLogger);
String clientKeyPassword = urlProps
.getProperty(SQLServerDriverStringProperty.CLIENT_KEY_PASSWORD.toString());

if (null != clientKeyPassword) {
controlConnectionProperties.setProperty(SQLServerDriverStringProperty.CLIENT_KEY_PASSWORD.toString(),
clientKeyPassword);
}
}

if (xaLogger.isLoggable(Level.FINER))
xaLogger.finer("Creating an internal control connection for" + toString());
physicalControlConnection = null;
Expand Down