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

ensure Plugin#original_params is hides password fields #4952

Closed
wants to merge 2 commits into from

Conversation

jsvd
Copy link
Member

@jsvd jsvd commented Mar 31, 2016

No description provided.

@@ -142,6 +142,11 @@ def config_init(params)
instance_variable_set("@#{key}", value)
end

# now that we know the parameters are valid, we can obfuscate the original copy
# of the parameters before storing them as an instance variable
self.class.validate_check_parameter_values(original_params)
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this actually doing the validation twice? I saw https://github.com/elastic/logstash/blob/master/logstash-core/lib/logstash/config/mixin.rb#L252-L265 that is basically the validation method.

I know this fixes the problem, I'm just wondering here if we should have a diff method or some kind of alias that show we're actually running the change to hide the password.

what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I struggled a bit with that, and I did a sample implementation of a method just to do that, but it's somewhat awkward and leads to some duplication of code.
I selected validate_check_parameter_values because it only takes care of validating arguments against their validators, so it doesn't populate default values, etc

Copy link
Contributor

Choose a reason for hiding this comment

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

I am doing some testing for that, not sure if it could have some side effect in specific cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am OK with this fix event if we are actually validating twice the submitted values.
The actual problem is we should split the value assignment from the validation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say, we should add an issue to cleanup this deb, are you ok with
that?

On Thu, Mar 31, 2016 at 3:37 PM Pier-Hugues Pellerin <
notifications@github.com> wrote:

In logstash-core/lib/logstash/config/mixin.rb
#4952 (comment):

@@ -142,6 +142,11 @@ def config_init(params)
instance_variable_set("@#{key}", value)
end

  • now that we know the parameters are valid, we can obfuscate the original copy

  • of the parameters before storing them as an instance variable

  • self.class.validate_check_parameter_values(original_params)

I am OK with this fix event if we are actually validating twice the
submitted values.
The actual problem is we should split the value assignment from the
validation.


You are receiving this because you commented.

Reply to this email directly or view it on GitHub
https://github.com/elastic/logstash/pull/4952/files/ad4641b6fdec0a4073212578ed22f82da392fb6d#r58053907

@ph
Copy link
Contributor

ph commented Mar 31, 2016

LGTM

@jsvd
Copy link
Member Author

jsvd commented Mar 31, 2016

refactored this so password hiding is done in a method created for this purpose alone. review welcome

@ph
Copy link
Contributor

ph commented Mar 31, 2016

I prefer that refactor, thanks @jsvd, LGTM even more.

@jsvd jsvd changed the title ensure Plugin#original_params is obfuscated ensure Plugin#original_params is hides password fields Mar 31, 2016
@purbon
Copy link
Contributor

purbon commented Mar 31, 2016

LGTM, but I would so as @andrewvc also recommended s/obfuscation/hidden (or similar)

@andrewvc
Copy link
Contributor

LGTM pending a change to that comment regarding obfuscation. I tested this manually and saw the password properly masked in the logs.

@elasticsearch-bot
Copy link

Andrew Cholakian merged this into the following branches!

Branch Commits
master b0b7a8c, 6369a43
5.0 dd11ecf, 54ab10d
2.3 9022ba8, 7dd4e88
2.2 6c80019, d29e7e3

elasticsearch-bot pushed a commit that referenced this pull request Mar 31, 2016
elasticsearch-bot pushed a commit that referenced this pull request Mar 31, 2016
elasticsearch-bot pushed a commit that referenced this pull request Mar 31, 2016
@jsvd jsvd deleted the safe_original_params branch March 31, 2016 20:56
jsvd added a commit that referenced this pull request Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants