-
Notifications
You must be signed in to change notification settings - Fork 86
Support both, encoded and non encoded api-key formats on plugin configuration #237
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
Support both, encoded and non encoded api-key formats on plugin configuration #237
Conversation
bb5ffb2 to
9842249
Compare
4c20b87 to
d98b81d
Compare
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.
Left some notes about code style.
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.
One final touch to make things even straight
e6e6a21 to
70ef0d2
Compare
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.
2 final nitpicks then we are ready to go :-)
CHANGELOG.md
Outdated
| @@ -1,3 +1,6 @@ | |||
| ## 5.2.1 | |||
| - Support both, encoded and non encoded api-key formats on plugin configuration [#237](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/237) | |||
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.
| - Support both, encoded and non encoded api-key formats on plugin configuration [#237](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/237) | |
| - Added support for encoded and non encoded api-key formats on plugin configuration [#237](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/237) |
lib/logstash/inputs/elasticsearch.rb
Outdated
| return {} unless (api_key&.value) | ||
|
|
||
| token = ::Base64.strict_encode64(api_key.value) | ||
| token = base64?(api_key.value) ? api_key.value : Base64.strict_encode64(api_key.value) |
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.
| token = base64?(api_key.value) ? api_key.value : Base64.strict_encode64(api_key.value) | |
| token = base64?(api_key.value) ? api_key.value : Base64.strict_encode64(api_key.value) |
70ef0d2 to
cdb00d0
Compare
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
Avoid double-encoding opaque Elasticsearch API keys.
Previously, API keys that were already in encoded format were incorrectly re-encoded, causing connection failures. This update ensures that only raw keys are encoded, supporting both opaque and id:api-key formats without issue.
Closes #236
Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/