-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Static authorization server interceptor implementation #8934
Conversation
ashithasantosh
commented
Feb 21, 2022
•
edited
Loading
edited
- Implements static authorization server interceptor with end to end tests.
- Adds support for "v3" HeaderMatcher proto by handling new fields like string_match.
1ee776d
to
1eb6932
Compare
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.
Was there a reason you didn't use RbacFilter directly?
CC @YifeiZhuang
I moved the rbac parsing logic to a common location in io.grpc.xds.internal.rbac.engine package due to following reasons
|
I think Eric is saying you only need to call |
In non-xDS authorization, we have upto two RBAC engines per Server Interceptor. And the grpc user can use the factory method to create the interceptor and attach it to server enabling grpc authorization. If we use rbac filter's method to generate server interceptor, then we would have upto two interceptors. This could complicate the API that we expose to the users or we could have two interceptors within an interceptor and keep the API unchanged. Also, when we introduce dynamic file reloading support, that is we reload the authorization policy periodically from file system, we would keep on creating new server interceptors as the policy changes, and this could complicate the design like we would have to consider the conditions where both interceptors aren't updated atomically, and we have authorization decisions being made with stale and new interceptor say. Plus code wise, I don't see any code duplication, just the creation and interception of interceptor, so I feel like we should keep xds and non-xds separate. **EDIT: We can just swap the old with new internal static interceptor in file watcher to deal with synchronization issues. I still prefer keeping them separate as it simplifies code. |
No. Two vs 1 interceptor internally should have no bearing on the API we expose to users. I suggest we do something like
|
Right! I meant the same thing above (quoting previous message "or we could have two interceptors within an interceptor and keep the API unchanged") |
@ejona86 Please take a look at the PR when you find time. Thank you:) |
@ejona86 Friendly ping!:) |
@ejona86 PTAL |
1 similar comment
@ejona86 PTAL |
authz/src/main/java/io/grpc/authz/AuthorizationServerInterceptor.java
Outdated
Show resolved
Hide resolved
@YifeiZhuang, do you know how we were missing contains and stringMatcher? |
Oh, apparently they aren't used by this code, so that resolves some of my questions. I think they were just added later. @ashithasantosh simply noticed they were missing when comparing to C++, which makes sense. |
847afd2
to
1b8f89c
Compare
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.
This looks good to me (modulo my comments), for the parts I've looked at. I'll let Yifei do the final full review.
authz/src/main/java/io/grpc/authz/AuthorizationServerInterceptor.java
Outdated
Show resolved
Hide resolved
@ejona86 Thank you for the review. PTAL I resolved all the comments. |