Skip to content

KAFKA-14265: Prefix ACLs may shadow other prefix ACLs#12695

Merged
cmccabe merged 2 commits into
apache:trunkfrom
cmccabe:KAFKA-14265
Sep 29, 2022
Merged

KAFKA-14265: Prefix ACLs may shadow other prefix ACLs#12695
cmccabe merged 2 commits into
apache:trunkfrom
cmccabe:KAFKA-14265

Conversation

@cmccabe

@cmccabe cmccabe commented Sep 29, 2022

Copy link
Copy Markdown
Contributor

Prefix ACLs may shadow other prefix ACLs. Consider the case where we have prefix ACLs for foobar, fooa, and f. If we were matching a resource named "foobar", we'd start scanning at the foobar ACL, hit the fooa ACL, and stop – missing the f ACL.

To fix this, we should re-scan for ACLs at the first divergence point (in this case, f) whenever we hit a mismatch of this kind.

@hachikuji hachikuji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good find. The fix LGTM, but we probably need some test cases.

// scanning in case there are any relevant PREFIX ACLs.
continue;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: extra new line

@cmccabe

cmccabe commented Sep 29, 2022

Copy link
Copy Markdown
Contributor Author

I added two tests. One unit test and one integration test. I verified that both fail without the fix. The integration tests succeeds with AclAuthorizer prior to the StandardAuthorizer fix.

@hachikuji hachikuji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@hachikuji

Copy link
Copy Markdown
Contributor

The build is failing due to the newly added test: kafka.api.AuthorizerIntegrationTest.testPrefixAcls(String).quorum=zk

@cmccabe cmccabe merged commit fc786c3 into apache:trunk Sep 29, 2022
@cmccabe cmccabe deleted the KAFKA-14265 branch September 29, 2022 16:22
@ijuma

ijuma commented Sep 30, 2022

Copy link
Copy Markdown
Member

Looks like we didn't squash this PR before merging. Let's avoid that next time please.

hachikuji added a commit that referenced this pull request Oct 4, 2022
In #12695, we discovered a gap in our testing of `StandardAuthorizer`. We addressed the specific case that was failing, but I think we need to establish a better methodology for testing which incorporates randomized inputs. This patch is a start in that direction. We implement a few basic property tests using jqwik which focus on prefix searching. It catches the case from #12695 prior to the fix. In the future, we can extend this to cover additional operation types, principal matching, etc.

Reviewers: David Arthur <mumrah@gmail.com>
cmccabe pushed a commit that referenced this pull request Oct 24, 2022
In #12695, we discovered a gap in our testing of `StandardAuthorizer`. We addressed the specific case that was failing, but I think we need to establish a better methodology for testing which incorporates randomized inputs. This patch is a start in that direction. We implement a few basic property tests using jqwik which focus on prefix searching. It catches the case from #12695 prior to the fix. In the future, we can extend this to cover additional operation types, principal matching, etc.

Reviewers: David Arthur <mumrah@gmail.com>
guozhangwang pushed a commit to guozhangwang/kafka that referenced this pull request Jan 25, 2023
In apache#12695, we discovered a gap in our testing of `StandardAuthorizer`. We addressed the specific case that was failing, but I think we need to establish a better methodology for testing which incorporates randomized inputs. This patch is a start in that direction. We implement a few basic property tests using jqwik which focus on prefix searching. It catches the case from apache#12695 prior to the fix. In the future, we can extend this to cover additional operation types, principal matching, etc.

Reviewers: David Arthur <mumrah@gmail.com>
rutvijmehta-harness pushed a commit to rutvijmehta-harness/kafka that referenced this pull request Feb 9, 2024
In apache#12695, we discovered a gap in our testing of `StandardAuthorizer`. We addressed the specific case that was failing, but I think we need to establish a better methodology for testing which incorporates randomized inputs. This patch is a start in that direction. We implement a few basic property tests using jqwik which focus on prefix searching. It catches the case from apache#12695 prior to the fix. In the future, we can extend this to cover additional operation types, principal matching, etc.

Reviewers: David Arthur <mumrah@gmail.com>
rutvijmehta-harness added a commit to rutvijmehta-harness/kafka that referenced this pull request Feb 9, 2024
… (#34)

In apache#12695, we discovered a gap in our testing of `StandardAuthorizer`. We addressed the specific case that was failing, but I think we need to establish a better methodology for testing which incorporates randomized inputs. This patch is a start in that direction. We implement a few basic property tests using jqwik which focus on prefix searching. It catches the case from apache#12695 prior to the fix. In the future, we can extend this to cover additional operation types, principal matching, etc.

Reviewers: David Arthur <mumrah@gmail.com>

Co-authored-by: Jason Gustafson <jason@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants