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 for whitespace in DB password text #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tanmally
Copy link

@tanmally tanmally commented Oct 2, 2020

This removes all whitespace in DB password (denoted by [:space:] in tr)

For eg: " test Passw0rd " will be modified to "testPassw0rd".

Note: This removes leading, trailing, and intermediate whitespace in password.

This removes all whitespace in db password (denoted by [:space:] in tr) For eg : " test Passw0rd " will be modified to  "testPassw0rd" . This removes leading, trailing, and intermediate whitespace in password .
@tanmally tanmally changed the title Fix for #142 Fix for whitespace in DB password text #142 Oct 2, 2020
@tanmally tanmally changed the title Fix for whitespace in DB password text #142 Fix for whitespace in DB password text Oct 2, 2020
@deitch
Copy link
Collaborator

deitch commented Oct 3, 2020

I have a question. Is this the right approach? I agree (mostly) with leading and trailing whitespace, but what about whitespace in the middle? Is "I am a pass" a legitimate password? For that matter, what about " I am a pass "? Two distinct questions:

  • should we be trimming in the middle?
  • should we be trimming at all?

Would it make more sense to include the password in single quotes, so that they get passed as a single arg?

@tanmally
Copy link
Author

tanmally commented Oct 3, 2020

What you have mentioned is something I thought of initially and I went with the approach
where "I am a pass" is kept the same and " I am a pass " was converted to "I am a pass"
but that did not work when we enter this in .env file

For eg: MYSQL_PASS= I am a pass

The reason I went with trimming the white space in between the password is to avoid the issue when read from .env file like the ones mentioned below

MYSQL_PASS=  mysqlPassW0rd
MYSQL_PASS=  mysql PassW0rd
MYSQL_PASS=  mysql Pass    W0rd   
MYSQL_PASS=mysqlPassW0rd   

@deitch
Copy link
Collaborator

deitch commented Oct 5, 2020

I can see how trimming whitespace at beginning and end would be right (again, I am not 100% sure of this), but if someone put whitespace in the middle, it is highly likely they intended to. I wouldn't want us to be in a place of second-guessing what they chose to do.

Any reason we cannot just go to quotes and not need to trim at all?

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

Successfully merging this pull request may close these issues.

2 participants