KAFKA-8860: Let SslPrincipalMapper split SSL principal mapping rules#7140
Closed
teebee wants to merge 1 commit intoapache:trunkfrom
teebee:teebee/ssl-principal-mapping-rules-handling
Closed
KAFKA-8860: Let SslPrincipalMapper split SSL principal mapping rules#7140teebee wants to merge 1 commit intoapache:trunkfrom teebee:teebee/ssl-principal-mapping-rules-handling
teebee wants to merge 1 commit intoapache:trunkfrom
teebee:teebee/ssl-principal-mapping-rules-handling
Conversation
Author
|
The changes should not have affected the failed test: Error detailsStacktraceStandard Output (STDOUT) |
omkreddy
approved these changes
Aug 17, 2019
Contributor
omkreddy
left a comment
There was a problem hiding this comment.
@teebee Thanks for the contribution. LGTM. Can you please file a JIRA? So that it will be easy to track the issue for others.
https://issues.apache.org/jira/projects/KAFKA/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #6099 tried to undo the splitting of the ssl.principal.mapper.rules list on comma with whitespace by sophisticated rejoining of the split list using a comma as separator. However, since possibly surrounding whitespace is not reconstructed this approach fails in general. Consider the following test case:
@test
public void testCommaWithWhitespace() throws Exception {
String value = "RULE:^CN=((\\, |\w)+)(,.|$)/$1/,DEFAULT";
}
The space after the escaped comma is essential. Unfortunately, it has disappeared after splitting and rejoining.
Moreover, in joinSplitRules the decision to rejoin list elements is based on local information only which might not be sufficient. It works for "RULE:^CN=([^,ADEFLTU,]+)(,.|$)/$1/" but fails for the equivalent regular expression "RULE:^CN=([^,DEFAULT,]+)(,.|$)/$1/".
The approach of the current PR is to change the type of the ssl.principal.mapper.rules attribute from LIST to STRING and to delegate the splitting of the rules to the SslPrincipalMapper. It knows about the structure of the rules and can perform the splitting context-based.