-
Notifications
You must be signed in to change notification settings - Fork 16
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
Implemented encryption support for only parts of the connection string #124
Conversation
host) with in the xcc connection string. Added test cases.
Codecov Report
@@ Coverage Diff @@
## development #124 +/- ##
=================================================
- Coverage 83.55% 83.52% -0.03%
- Complexity 1282 1284 +2
=================================================
Files 45 45
Lines 4146 4170 +24
Branches 619 624 +5
=================================================
+ Hits 3464 3483 +19
- Misses 459 460 +1
- Partials 223 227 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to make these changes
try { | ||
Pattern pattern = Pattern.compile(XCC_CONNECTION_URI_PATTERN); | ||
Matcher matcher = pattern.matcher(connectionUri); | ||
matcher.find(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to invoke matcher.find()
if we are going to ignore it
LOG.info("Checking if any part of the connection string are encrypted"); | ||
String uriAfterDecrypt = connectionUri; | ||
try { | ||
Pattern pattern = Pattern.compile(XCC_CONNECTION_URI_PATTERN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be moved outside of the try/catch
password = this.decrypter.decrypt(XCC_PASSWORD, password); | ||
host = this.decrypter.decrypt(XCC_HOSTNAME, host); | ||
dbname = !isBlank(dbname) ? this.decrypter.decrypt(XCC_DBNAME, dbname) : null; | ||
uriAfterDecrypt = StringUtils.getXccUri(protocol, username, password, host, port, dbname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.
is not necessary
- removing `this.` where not needed - moving `pattern.compile()` outside of try block - removing unnecessary `matcher.find()`
[Issue-123] Supporting encryption of password, username, hostname or dbname fields of the connection string. This should enable customers to keep the existing connection string, but only encrypt the password field. Also, encrypted portion can be optionally enclosed with in ENC(). Added additional test cases to AbstractManagerTest to test this new feature. I have also done some manual testing of various use cases.