Skip to content

KAFKA-8774: Regex can be found anywhere in config value#7197

Merged
rhauch merged 3 commits intoapache:trunkfrom
wicknicks:KAFKA-8774
Aug 13, 2019
Merged

KAFKA-8774: Regex can be found anywhere in config value#7197
rhauch merged 3 commits intoapache:trunkfrom
wicknicks:KAFKA-8774

Conversation

@wicknicks
Copy link
Copy Markdown
Contributor

@wicknicks wicknicks commented Aug 12, 2019

Signed-off-by: Arjun Satish arjun@confluent.io

The original method incorrectly used matcher.matches() instead of matcher.find(). The former method expects the entire string to match the regex, whereas the second one can find a pattern anywhere within the input string (which fits this use case more correctly).

Added unit tests.

Should be backported to 2.0.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Signed-off-by: Arjun Satish <arjun@confluent.io>
@wicknicks
Copy link
Copy Markdown
Contributor Author

@rhauch @avocader would appreciate a review. thanks!

Copy link
Copy Markdown
Contributor

@rhauch rhauch left a comment

Choose a reason for hiding this comment

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

Great find, @wicknicks! I like the minimalist PR, but have a few suggestions for being a bit more thorough with the new unit tests.

Signed-off-by: Arjun Satish <arjun@confluent.io>
Copy link
Copy Markdown
Contributor

@rhauch rhauch left a comment

Choose a reason for hiding this comment

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

LGTM, pending a green build. Thanks, @wicknicks!

Update system tests to cover case where config value contains
additional characters besides secret that requires regex pattern
to be found anywhere in the string (as opposed to complete match).

Signed-off-by: Arjun Satish <arjun@confluent.io>
@wicknicks
Copy link
Copy Markdown
Contributor Author

Updated a system test, here is a clean run https://jenkins.confluent.io/job/system-test-kafka-branch-builder/2884/

Copy link
Copy Markdown
Contributor

@rhauch rhauch left a comment

Choose a reason for hiding this comment

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

Thanks for updating the system test. LGTM!

@rhauch rhauch merged commit 7946372 into apache:trunk Aug 13, 2019
rhauch pushed a commit that referenced this pull request Aug 13, 2019
Corrected the AbstractHerder to correctly identify task configs that contain variables for externalized secrets. The original method incorrectly used `matcher.matches()` instead of `matcher.find()`. The former method expects the entire string to match the regex, whereas the second one can find a pattern anywhere within the input string (which fits this use case more correctly).

Added unit tests to cover various cases of a config with externalized secrets, and updated system tests to cover case where config value contains additional characters besides secret that requires regex pattern to be found anywhere in the string (as opposed to complete match).

Author: Arjun Satish <arjun@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
rhauch pushed a commit that referenced this pull request Aug 13, 2019
Corrected the AbstractHerder to correctly identify task configs that contain variables for externalized secrets. The original method incorrectly used `matcher.matches()` instead of `matcher.find()`. The former method expects the entire string to match the regex, whereas the second one can find a pattern anywhere within the input string (which fits this use case more correctly).

Added unit tests to cover various cases of a config with externalized secrets, and updated system tests to cover case where config value contains additional characters besides secret that requires regex pattern to be found anywhere in the string (as opposed to complete match).

Author: Arjun Satish <arjun@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
rhauch pushed a commit that referenced this pull request Aug 13, 2019
Corrected the AbstractHerder to correctly identify task configs that contain variables for externalized secrets. The original method incorrectly used `matcher.matches()` instead of `matcher.find()`. The former method expects the entire string to match the regex, whereas the second one can find a pattern anywhere within the input string (which fits this use case more correctly).

Added unit tests to cover various cases of a config with externalized secrets, and updated system tests to cover case where config value contains additional characters besides secret that requires regex pattern to be found anywhere in the string (as opposed to complete match).

Author: Arjun Satish <arjun@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
rhauch pushed a commit that referenced this pull request Aug 13, 2019
Corrected the AbstractHerder to correctly identify task configs that contain variables for externalized secrets. The original method incorrectly used `matcher.matches()` instead of `matcher.find()`. The former method expects the entire string to match the regex, whereas the second one can find a pattern anywhere within the input string (which fits this use case more correctly).

Added unit tests to cover various cases of a config with externalized secrets, and updated system tests to cover case where config value contains additional characters besides secret that requires regex pattern to be found anywhere in the string (as opposed to complete match).

Author: Arjun Satish <arjun@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
@wicknicks wicknicks deleted the KAFKA-8774 branch August 13, 2019 17:11
xiowu0 pushed a commit to linkedin/kafka that referenced this pull request Aug 22, 2019
… config value (apache#7197)

TICKET = KAFKA-8774
LI_DESCRIPTION =
EXIT_CRITERIA = HASH [b85707c]
ORIGINAL_DESCRIPTION =

Corrected the AbstractHerder to correctly identify task configs that contain variables for externalized secrets. The original method incorrectly used `matcher.matches()` instead of `matcher.find()`. The former method expects the entire string to match the regex, whereas the second one can find a pattern anywhere within the input string (which fits this use case more correctly).

Added unit tests to cover various cases of a config with externalized secrets, and updated system tests to cover case where config value contains additional characters besides secret that requires regex pattern to be found anywhere in the string (as opposed to complete match).

Author: Arjun Satish <arjun@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
(cherry picked from commit b85707c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants