-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Validate monitoring password at parse time #47740
Conversation
Pinging @elastic/es-core-features (:Core/Features/Monitoring) |
new Setting.Validator<String>() { | ||
@Override | ||
public void validate(String password) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment to why this is empty ?
edit: i mean a comment in the code :)
if (Strings.isNullOrEmpty(username)) { | ||
if (Strings.isNullOrEmpty(password) == false) { | ||
throw new SettingsException( | ||
"[" + AUTH_PASSWORD_SETTING.getConcreteSettingForNamespace(namespace).getKey() + "] without [" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the test assert this message is in the error too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NMVD I see it now .. it already did. sorry for the noise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (nit request to add comment to empty method.)
assertThat( | ||
e, | ||
hasToString( | ||
containsString("Failed to parse value [_pass] for setting [xpack.monitoring.exporters._http.auth.password]"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I just realized this will place a password in the log file. Can you log an enhancement to help prevent this ?
@elasticmachine update branch |
@jakelandis, I think all review concerns have been addressed between the additional commits and #48066. |
@jakelandis, @rjernst, could you let me know if this one looks good to you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
|
||
@Override | ||
public void validate(String password, Map<Setting<?>, Object> settings) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need similar validation in AUTH_USERNAME_SETTING? Otherwise we could have username exist but no password?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, thanks. i guess this PR is out of date with master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@elasticmachine update branch |
Provides parse-time validation for
AUTH_PASSWORD_SETTING
as described in #47711.