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

STORM-3184: Mask the plaintext passwords from the logs #2801

Merged
merged 4 commits into from Aug 14, 2018

Conversation

arunmahadevan
Copy link
Contributor

Introduce a Password config annotation and use it to mark configs that are
sensitive and mask the values while logging.

Master port of #2798

Introduce a `Password` config annotation and use it to mark configs that are
sensitive and mask the values while logging.
@@ -52,6 +79,16 @@ public static ConfigUtils setInstance(ConfigUtils u) {
return oldInstance;
}

public static Map<String, Object> maskPasswords(final Map<String, Object> conf) {
Maps.EntryTransformer<String, Object, Object> maskPasswords =
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we replace this with Java streams API and remove Guava dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is that the map is traversed and copied even if we don't intend to log the conf and I was trying to avoid it using the Guava transformer. It may not be a major issue now since the conf is logged only once at the beginning, but wanted to avoid any potential future misuse.

I could not figure out a way to do the same with java 8 Streams API. I have refactored it to return a wrapped object which will be evaluated only when its required to log. Please take a look and let me know if it makes sense or if theres a better way.

Copy link
Contributor

Choose a reason for hiding this comment

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

@arunmahadevan
Ah OK that makes sense. I should have made clear that my concern was adding guava to the dependency without shading. You can revert the logic with using shaded guava.

https://github.com/apache/storm/blob/master/shaded-deps/pom.xml#L207-L218

Sorry about the confusion.

Copy link
Contributor

Choose a reason for hiding this comment

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

@arunmahadevan
I also think this approach can replace Utils.radactValue via adding @password to STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD.
What do you think? Looks like we don't need to have both approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@HeartSaVioR , thanks for the suggestion, we can replace STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD too.

I was not aware of the "shaded-deps" module and its usage.

Reverted to the earlier approach and using the shaded-deps now.

@HeartSaVioR
Copy link
Contributor

HeartSaVioR commented Aug 11, 2018

@arunmahadevan Looks like we don't need to introduce Guava for this patch into master branch (maybe we are already using shaded artifact for guava?). I understand this is annoying to apply Java 7 / Java 8 for each branch, but let's keep this approach until we ship Storm 2.0.0.

Copy link
Contributor

@HeartSaVioR HeartSaVioR left a comment

Choose a reason for hiding this comment

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

+1

@asfgit asfgit merged commit c12ddb3 into apache:master Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants