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

Fix logstash-keystore to accept spaces in values when added via stdin #17039

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

kaisecheng
Copy link
Contributor

Release notes

Fix logstash-keystore to accept spaces in values when added via stdin

What does this PR do?

logstash-keystore incorrectly handled values containing spaces, causing only the first word to be stored.
For example, a value like "Hello, world!" was split, resulting in "Hello," as the stored value instead of the full string.
This commit preserves spaces in values, ensuring that multi-word strings are stored as intended.

Why is it important/What is the impact to the user?

This issue mainly affected ECK users who followed best practices for managing secure settings, leading to incorrect value assignments.

apiVersion: v1
kind: Secret
metadata:
  name: logstash-secure-settings
  namespace: logstash-sample
stringData:
  hello: "Hello, world!"
  bye: "bye"

Users who use stdin to add value are impacted as well. For example, echo "somevalue" | bin/logstash-keystore add hello

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • [ ]

How to test this PR locally

echo "hello world" | bin/logstash-keystore add hello
bin/logstash -e "input{ generator{ count => 1 tags => ['${hello}'] }}"

it should print "hello world"

Related issues

Use cases

Screenshots

Logs

Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Copy link
Member

@robbavey robbavey left a comment

Choose a reason for hiding this comment

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

lgtm

@kaisecheng kaisecheng merged commit 5573b5a into elastic:main Feb 7, 2025
7 checks passed
@kaisecheng
Copy link
Contributor Author

@logstashmachine backport 8.18

github-actions bot pushed a commit that referenced this pull request Feb 7, 2025
…#17039)

This commit preserves spaces in values, ensuring that multi-word strings are stored as intended.
Prior to this change, `logstash-keystore` incorrectly handled values containing spaces,
causing only the first word to be stored.

(cherry picked from commit 5573b5a)
kaisecheng added a commit that referenced this pull request Feb 7, 2025
…#17039) (#17040)

This commit preserves spaces in values, ensuring that multi-word strings are stored as intended.
Prior to this change, `logstash-keystore` incorrectly handled values containing spaces,
causing only the first word to be stored.

(cherry picked from commit 5573b5a)

Co-authored-by: kaisecheng <[email protected]>
@kaisecheng
Copy link
Contributor Author

@logstashmachine backport 8.17

github-actions bot pushed a commit that referenced this pull request Feb 7, 2025
…#17039)

This commit preserves spaces in values, ensuring that multi-word strings are stored as intended.
Prior to this change, `logstash-keystore` incorrectly handled values containing spaces,
causing only the first word to be stored.

(cherry picked from commit 5573b5a)
@kaisecheng
Copy link
Contributor Author

@logstashmachine backport 9.0

kaisecheng added a commit that referenced this pull request Feb 7, 2025
…#17039) (#17041)

This commit preserves spaces in values, ensuring that multi-word strings are stored as intended.
Prior to this change, `logstash-keystore` incorrectly handled values containing spaces,
causing only the first word to be stored.

(cherry picked from commit 5573b5a)

Co-authored-by: kaisecheng <[email protected]>
github-actions bot pushed a commit that referenced this pull request Feb 7, 2025
…#17039)

This commit preserves spaces in values, ensuring that multi-word strings are stored as intended.
Prior to this change, `logstash-keystore` incorrectly handled values containing spaces,
causing only the first word to be stored.

(cherry picked from commit 5573b5a)
@github-actions github-actions bot added the v9.0.0 label Feb 7, 2025
kaisecheng added a commit that referenced this pull request Feb 7, 2025
…#17039) (#17042)

This commit preserves spaces in values, ensuring that multi-word strings are stored as intended.
Prior to this change, `logstash-keystore` incorrectly handled values containing spaces,
causing only the first word to be stored.

(cherry picked from commit 5573b5a)

Co-authored-by: kaisecheng <[email protected]>
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.

Logstash keystore --stdin option
3 participants