Skip to content
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

[draft] Implement Rbac Engine #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

zasweq
Copy link
Owner

@zasweq zasweq commented May 13, 2021

For comments and guidance

// based on the Envoy RBAC Proto, and will be created in two use cases, one in regular
// gRPC and one from XDS and TrafficDirector. The engine will then be passed in data pulled
// from incoming RPC's to the server side.
type RbacEngine struct {
Copy link

Choose a reason for hiding this comment

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

RBACEngine

(if not exported:)
rbacEngine

Copy link
Owner Author

Choose a reason for hiding this comment

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

Made acronym capital.

// based on a policy. This policy will be used to instantiate a tree
// of matchers that will be used to make an authorization decision on
// an incoming RPC.
func NewRbacEngine(policy *v3rbacpb.RBAC) *RbacEngine {
Copy link

Choose a reason for hiding this comment

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

NewRBACEngine

Copy link
Owner Author

Choose a reason for hiding this comment

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

Made capital.

// evaluateArgs represents the data pulled from an incoming RPC to a gRPC server.
// This data will be passed around the RBAC Engine and pass through the logical tree of matchers,
// and will help determine whether a RPC is allowed to proceed.
type evaluateArgs struct {
Copy link

Choose a reason for hiding this comment

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

Export

Copy link
Owner Author

Choose a reason for hiding this comment

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

Exported all api level data and fields.

Comment on lines 45 to 46
// This data will be passed around the RBAC Engine and pass through the logical tree of matchers,
// and will help determine whether a RPC is allowed to proceed.
Copy link

Choose a reason for hiding this comment

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

Impl detail; remove

Copy link
Owner Author

Choose a reason for hiding this comment

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

Deleted impl details from top level API comments.

Comment on lines 11 to 16
// authorizationDecision is what will be returned from the RBAC Engine
// when it is asked to see if an rpc should be allowed or denied.
type authorizationDecision struct {
decision v3rbacpb.RBAC_Action
matchingPolicyName string
}
Copy link

Choose a reason for hiding this comment

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

Needs export

Copy link
Owner Author

Choose a reason for hiding this comment

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

Exported.

@@ -0,0 +1,71 @@
package authorization
Copy link

Choose a reason for hiding this comment

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

package rbac

type Engine struct {}

principals *orMatcher
}

func createPolicyMatcher(policy *v3rbacpb.Policy) *policyMatcher {
Copy link

Choose a reason for hiding this comment

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

newPolicyMatcher

Copy link
Owner Author

Choose a reason for hiding this comment

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

Switched all createX to newX. Left createListFromPermission/Policy as that is not a tree node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants