- Notifications
You must be signed in to change notification settings - Fork 3.5k
Improve the key validation in secret identifier. #17351
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
Improve the key validation in secret identifier. #17351
Conversation
This pull request does not have a backport label. Could you fix it @mashhurs? 🙏
|
This sounds like a breaking change.
|
📃 DOCS PREVIEW ✨ https://logstash_bk_17351.docs-preview.app.elstc.co/diff |
Yeah, didn't think of the case if keystore had invalid keys already included.
|
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.
Mechanically, this works, and safely guards against adding keys that cannot be referenced in the pipelines without breaking users whose keystores include offending keys.
I've left suggestions about DRY-ing it up a bit, and improving the admitedly-difficult description of the effective key pattern requirement.
logstash-core/src/main/java/org/logstash/secret/SecretIdentifier.java Outdated Show resolved Hide resolved
logstash-core/src/main/java/org/logstash/secret/SecretIdentifier.java Outdated Show resolved Hide resolved
📃 DOCS PREVIEW ✨ https://logstash_bk_17351.docs-preview.app.elstc.co/diff |
1 similar comment
📃 DOCS PREVIEW ✨ https://logstash_bk_17351.docs-preview.app.elstc.co/diff |
9139460
to 6ac79ce
Compare 📃 DOCS PREVIEW ✨ https://logstash_bk_17351.docs-preview.app.elstc.co/diff |
…ey names to the keystore through keystore CLI. Keysotre now warns on invalid keys if they were already added.
[doc] better explanation of accepting key format. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com>
…ription. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com>
6ac79ce
to bfea29d
Compare Rebased against main as we were having CI issues, fixed by #17531 |
📃 DOCS PREVIEW ✨ https://logstash_bk_17351.docs-preview.app.elstc.co/diff |
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.
👍🏼 looking on-track.
I've left a comment about message format, and suggested more useful random key generation for tests.
logstash-core/src/main/java/org/logstash/secret/cli/SecretStoreCli.java Outdated Show resolved Hide resolved
logstash-core/src/test/java/org/logstash/secret/cli/SecretStoreCliTest.java Outdated Show resolved Hide resolved
logstash-core/src/main/java/org/logstash/secret/SecretIdentifier.java Outdated Show resolved Hide resolved
logstash-core/src/main/java/org/logstash/secret/SecretIdentifier.java Outdated Show resolved Hide resolved
Warning and error messages well formatted. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com>
📃 DOCS PREVIEW ✨ https://logstash_bk_17351.docs-preview.app.elstc.co/diff |
📃 DOCS PREVIEW ✨ https://logstash_bk_17351.docs-preview.app.elstc.co/diff |
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.
Works as advertised.
I've left one nit-pick about making the validation step more cohesive, but you're free to decide whether to resolve it or not.
logstash-core/src/main/java/org/logstash/secret/SecretIdentifier.java Outdated Show resolved Hide resolved
|
💚 Build Succeeded
History
cc @mashhurs |
@Mergifyio backport 8.17 8.18 8.19 9.0 |
✅ Backports have been created
|
* Improve the key validation in secret identifier. * Restrict adding invalid (from ConfigVariableExpander point of view) key names to the keystore through keystore CLI. Keystore now warns on invalid keys if they were already added. * Key pattern is moved to a central config expander class with its description. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com> (cherry picked from commit d24675a) # Conflicts: # docs/reference/keystore.md
* Improve the key validation in secret identifier. * Restrict adding invalid (from ConfigVariableExpander point of view) key names to the keystore through keystore CLI. Keystore now warns on invalid keys if they were already added. * Key pattern is moved to a central config expander class with its description. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com> (cherry picked from commit d24675a) # Conflicts: # docs/reference/keystore.md
* Improve the key validation in secret identifier. * Restrict adding invalid (from ConfigVariableExpander point of view) key names to the keystore through keystore CLI. Keystore now warns on invalid keys if they were already added. * Key pattern is moved to a central config expander class with its description. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com> (cherry picked from commit d24675a) # Conflicts: # docs/reference/keystore.md
* Improve the key validation in secret identifier. * Restrict adding invalid (from ConfigVariableExpander point of view) key names to the keystore through keystore CLI. Keystore now warns on invalid keys if they were already added. * Key pattern is moved to a central config expander class with its description. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com> (cherry picked from commit d24675a)
* Improve the key validation in secret identifier. * Restrict adding invalid (from ConfigVariableExpander point of view) key names to the keystore through keystore CLI. Keystore now warns on invalid keys if they were already added. * Key pattern is moved to a central config expander class with its description. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com> (cherry picked from commit d24675a) Co-authored-by: Mashhur <99575341+mashhurs@users.noreply.github.com>
…ier. (#17585) * Improve the key validation in secret identifier. (#17351) * Improve the key validation in secret identifier. * Restrict adding invalid (from ConfigVariableExpander point of view) key names to the keystore through keystore CLI. Keystore now warns on invalid keys if they were already added. * Key pattern is moved to a central config expander class with its description. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com> (cherry picked from commit d24675a) # Conflicts: # docs/reference/keystore.md * Adjust the doc against 8.x --------- Co-authored-by: Mashhur <99575341+mashhurs@users.noreply.github.com> Co-authored-by: Mashhur <mashhur.sattorov@elastic.co>
…ier. (#17586) * Improve the key validation in secret identifier. (#17351) * Improve the key validation in secret identifier. * Restrict adding invalid (from ConfigVariableExpander point of view) key names to the keystore through keystore CLI. Keystore now warns on invalid keys if they were already added. * Key pattern is moved to a central config expander class with its description. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com> (cherry picked from commit d24675a) # Conflicts: # docs/reference/keystore.md * Adjust docs against 8.x --------- Co-authored-by: Mashhur <99575341+mashhurs@users.noreply.github.com> Co-authored-by: Mashhur <mashhur.sattorov@elastic.co>
…ier. (#17587) * Improve the key validation in secret identifier. (#17351) * Improve the key validation in secret identifier. * Restrict adding invalid (from ConfigVariableExpander point of view) key names to the keystore through keystore CLI. Keystore now warns on invalid keys if they were already added. * Key pattern is moved to a central config expander class with its description. Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com> (cherry picked from commit d24675a) # Conflicts: # docs/reference/keystore.md * Adjust docs against 8.x --------- Co-authored-by: Mashhur <99575341+mashhurs@users.noreply.github.com> Co-authored-by: Mashhur <mashhur.sattorov@elastic.co>
* add applies_to badge to changes introduced in #17351 * add applies_to badge to changes introduced in #17759 * reorder list items * use 9.0.1 not 9.1.0 * Update docs/reference/keystore.md Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com> --------- Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
* add applies_to badge to changes introduced in #17351 * add applies_to badge to changes introduced in #17759 * reorder list items * use 9.0.1 not 9.1.0 * Update docs/reference/keystore.md Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com> --------- Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com> (cherry picked from commit aed28eb)
* add applies_to badge to changes introduced in #17351 * add applies_to badge to changes introduced in #17759 * reorder list items * use 9.0.1 not 9.1.0 * Update docs/reference/keystore.md --------- (cherry picked from commit aed28eb) Co-authored-by: Colleen McGinnis <colleen.mcginnis@elastic.co> Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
Release notes
${
...}
).What does this PR do?
Before this change, key-value can be added to keystore but it might impossible to reference the key because
ConfigVariableExpander
ignores if key name doesn't align withSUBSTITUTION_PLACEHOLDER_REGEX
Improves user experience with the secret store CLI that when providing key name, LS validates to accept a value which can be used in pipeline (aligns with
ConfigVariableExpander#SUBSTITUTION_PLACEHOLDER_REGEX
).If already invalid key(s) were added, it warns to remove/replace the keys.
Why is it important/What is the impact to the user?
No user impact. Keystore CLI restricts adding meaningless keys to keystore.
Checklist
[] I have made corresponding changes to the documentation[] I have made corresponding change to the default configuration files (and/or docker env variables)Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs