Skip to content

Add no_jwt_patterns to auth.proto #345

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
315 changes: 278 additions & 37 deletions mixer/v1/config/client/auth.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions mixer/v1/config/client/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@ message EndUserAuthenticationPolicySpec {
// JWT validation is skipped if the user's traffic request does not
// include a JWT.
repeated JWT jwts = 2;

// This message defines a pattern to match a request.
// A pattern is matched only if both http_method and path_prefix are matched.
message Pattern {
// Define a HTTP method.
string http_method = 1;

// Defines a path prefix to match
string path_prefix = 2;
}

// If a request doesn't have JWT, it will be rejected.
// But some requests are OK without JWT, such as OPTIONS for CORS,
// or some paths for health checking.
// If a request matches any of no_jwt_patterns, it is OK without JWT.
repeated Pattern no_jwt_patterns = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

This becomes another specialized URL map, and you also put the business logic with the map. There are too much business logic connected together here.

Why EndUser is mentioned in the proto spec? Why the auth is not a service account, or a mobile device, or a IoT, or a delegated service, or impersonation? I think we should have an abstraction here. The URL map produce an operation id, and the operation id maps to authentication requirements. The concept of JWT or end user should not be the top level concept.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will address some of your concerns with this issue
#344

Copy link
Contributor

Choose a reason for hiding this comment

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

EndUserAuthenticationPolicy can be renamed to auth filter config with #344. There was some previous discussion about treating this matching as authZ problem and handling in the mixer. But that can be inefficient as we end up unconditionally trying to validate all JWT for a host regardless of the path/method. Could an attribute match condition similar to the quotaspec make sense here, or should it be specialized for specific attributes (e.g. api.operation)?

The top-level AuthenticationPolicy (see #335) possibly ought to support this mapping of auth requirements to particular sets of operations (or entire service or maybe even namespace). @diemtvu

Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand correctly, this is aligned with the SelectCriteria discussed here, though I haven't fully fleshed out all details. However, our intention is to have that in the AuthN policy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should be careful about which level of config we are talking here. This is NOT user level config. This is low-level component level config. Specifically this is the config for Envoy auth filter defined here: https://github.com/istio/proxy/blob/master/src/envoy/auth/config.proto

Auth filter will be upstreamed to Envoy. It should not depended on any Istio proto files. That config proto is just copied from this proto file. So this proto file is the low level Envoy filter config for Mixer Filter and Auth filter.

User level auth config will be defined in @diemtvu PR #335

Copy link
Contributor

Choose a reason for hiding this comment

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

We can depend on core protos in data-plane-api. If there is no good match, then we can start a discussion to add another core proto. There's value in consolidating proto definitions, instead of copying them from place to place.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am a bit confused by the structure of this proto. Pattern matching is a common way for software, and it should looks like this way for most people:

match xxx:
  action

This proto puts the pattern matching inside the action, which is counter intuitive.

Pattern matching on request should be a common function across Envoy and Istio. I strongly prefer we define it in a central place. JWT rule essentially an action that produces the request auth attributes.

}

message EndUserAuthenticationPolicySpecReference {
Expand Down
Loading