Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Improved DB password masking to mask special characters (non alpha-numeric) as well #9

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

zsimic
Copy link
Contributor

@zsimic zsimic commented Jul 2, 2012

We found that only alphanumeric characters in passwords were masked, this fix makes sure that special characters (non alphanumeric) get masked as well.

def temp = File.createTempFile("cfg2", "properties")
temp.write '<property name="db.member2.db_url" value="jdbc:oracle:thin:Encrypted-AES/CBC/PKCS5Padding(3QIdAjOKfAqcetGKhHEWez,0VWjpS2ewydmPFX8y-F3M_,umlHnS9A)@//test.prod.linkedin.com:1521/PROD_PMEM2_MEMBER2" /> \n'

DataMaskingInputStream stream = new DataMaskingInputStream(temp.newDataInputStream())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is just a test, but you are opening an input stream without ever closing it.

Why not simply use a String? Then you would not have this issue (although it is still a good practice to always close what you open).

new BytArrayInputStream(s.getBytes("UTF-8")) to get an input stream from a string...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point, correcting this test class and updating the pull request

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants