Skip to content

authz: RBAC filter config PBs + flexibility changes#3477

Merged
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
rodaine:rbac-protos
May 24, 2018
Merged

authz: RBAC filter config PBs + flexibility changes#3477
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
rodaine:rbac-protos

Conversation

@rodaine
Copy link
Member

@rodaine rodaine commented May 23, 2018

This patch splits out the proto config changes for the RBAC filter from #3455 for easier review, as well as to unblock implementors from consuming these configs ASAP. Of note, these changes make the rules for permissions/principals more explicit in terms of their application (AND vs OR) as well as permits mixing and matching different types of matchers together within those logical operators. This facilitates inflation of these rules into the matchers within the RBAC engine inside Envoy as well as affords an extra level of flexibility to defining the config. These changes are compatible with the previous definitions, if more verbose.

Risk Level: Low (unused proto changes)
Testing: N/A
Docs: N/A
Release Notes: N/A

Signed-off-by: Chris Roche croche@lyft.com

Signed-off-by: Chris Roche <croche@lyft.com>
@@ -68,90 +74,70 @@ message Policy {
repeated Principal principals = 2 [(validate.rules).repeated .min_items = 1];
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that there is space between "repeated" and ".min_items"? Should it be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

The clang-format rules doesn't distinguish between the option name and the repeated decorator for a field. Unfortunately this has to remain but it's fortunately compatible with protoc


// Source IP addresses.
IpMatch source_ips = 2;
// A set of identifiers that all must match in order to define the principal.
Copy link
Contributor

Choose a reason for hiding this comment

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

"all must match"->"at least one must match".

Copy link
Member Author

Choose a reason for hiding this comment

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

doh good catch

// ":ref: `AttributeContext <envoy_api_msg_service.auth.v2alpha.AttributeContext>`.
// If unset, it applies to any user.
// The name of the principal. If set, the URI SAN is used from the certificate, otherwise the
// subject field is used. If unset, it applies to any user that is authenticated.
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the "subject field"? Is "unset" of this field equivalent to "any" field set to "true"?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the same behavior as in ext authz / AttributeContext, it uses the URI SAN if present, otherwise, it uses the subject field off the certificate.

if a principal has authenticated set with its name unset it means that the request must be authenticated, but does not care who the subject is.

message Principal {

message Set {
repeated Principal ids = 1 [(validate.rules).repeated .min_items = 1];
Copy link
Contributor

Choose a reason for hiding this comment

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

space between "repeated" and ".min_items"?

Signed-off-by: Chris Roche <croche@lyft.com>
liminw
liminw previously approved these changes May 23, 2018
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM, this is great, thanks. Just some small doc asks.

repeated envoy.type.StringMatch values = 2;
}
message Set {
repeated Permission rules = 1 [(validate.rules).repeated .min_items = 1];
Copy link
Member

Choose a reason for hiding this comment

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

Per offline convo can we add some more docs/explanation of what the AND/OR behavior is of this repeated lists? I think that would be helpful.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, these are just wrappers since you can't have a repeated field in a oneof. Adding a comment to specify that the application is dependent on whether it's in and_rules/ids vs or_rules/ids

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

(But more comments here fine too)


// Optional. Custom conditions.
repeated Condition conditions = 3;
// When any is set, it matches any action.
Copy link
Member

Choose a reason for hiding this comment

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

On this field (and the same one on principal) can we add a bit more docs explaining the usage (effectively that it's explicit and a policy needs to have at least one permission and principal).

Signed-off-by: Chris Roche <croche@lyft.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

This is awesome, just found a small typo, thanks.

//
message RBAC {
// Should we do white-list or black-list style access control.
// Should we do white-list or black-list style access control?
Copy link
Member

Choose a reason for hiding this comment

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

I think you had a typo here?

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind I see you made this into a question.

@mattklein123 mattklein123 merged commit 9d0f0a8 into envoyproxy:master May 24, 2018
@rodaine rodaine deleted the rbac-protos branch May 25, 2018 22:07
talnordan added a commit to talnordan/envoy that referenced this pull request Jul 19, 2018
Fix the description of an `RBAC` Protobuf message example, so that it
matches the changes made to the YAML code block in PR envoyproxy#3477.

Risk Level: Low
Testing: N/A
Docs Changes: N/A
Release Notes: N/A

Signed-off-by: Tal Nordan <tal.nordan@solo.io>
mattklein123 pushed a commit that referenced this pull request Jul 19, 2018
Fix the description of an `RBAC` Protobuf message example, so that it
matches the changes made to the YAML code block in PR #3477.

Risk Level: Low
Testing: N/A
Docs Changes: N/A
Release Notes: N/A

Signed-off-by: Tal Nordan <tal.nordan@solo.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