Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

[mysql-persistence] Do not log plain passwords #5665

Merged
merged 2 commits into from
Sep 21, 2018
Merged

[mysql-persistence] Do not log plain passwords #5665

merged 2 commits into from
Sep 21, 2018

Conversation

martinvw
Copy link
Member

Fixes: openhab/openhab-distro#762

Signed-off-by: Martin van Wingerden martin@martinvw.nl

Signed-off-by: Martin van Wingerden <martin@martinvw.nl>
@@ -553,7 +553,7 @@ private void connectToDatabase() {
} catch (Exception e) {
logger.error(
"mySQL: Failed connecting to the SQL database using: driverClass={}, url={}, user={}, password={}",
driverClass, url, user, password, e);
driverClass, url, user, password.replaceAll(".", "*"), e);
Copy link
Member

Choose a reason for hiding this comment

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

You are still exposing some information about the password here (its length), which should also be avoided, see the comment at eclipse-archived/smarthome#4583 (comment).

So I'd suggest to either put 8 asterisks or maybe simply remove the password part completely here as it anyhow is not helpful.

Copy link
Member Author

Choose a reason for hiding this comment

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

@kaikreuzer, I like that, shall I also remove it then in all other places in this repo.

Should I also apply it for trace logging? or is that configurable and thus okay.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, can be removed from other places as well from the logging.
I'd also remove it from trace statements.

Signed-off-by: Martin van Wingerden <martin@martinvw.nl>
@martinvw
Copy link
Member Author

Hi @kaikreuzer, its updated!

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

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

Thanks! Wow these were quite many places 😟

@kaikreuzer kaikreuzer merged commit 35f5a29 into openhab:master Sep 21, 2018
@CrappyTan
Copy link

Thank you

@martinvw martinvw deleted the feature/mysql-do-not-log-plain-password branch September 21, 2018 07:02
@martinvw
Copy link
Member Author

@CrispinP thank you for reporting it.

Note that I also created follow up issue for openHAB2 addons

https://github.com/openhab/openhab2-addons/issues/3990

@wborn wborn added this to the 1.13.0 milestone Dec 10, 2019
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.

Persistence passwords in logfile
4 participants