Skip to content

Add unauthorized boolean the accesslog.#505

Merged
htuch merged 7 commits intoenvoyproxy:masterfrom
colabsaumoh:access-log
Mar 1, 2018
Merged

Add unauthorized boolean the accesslog.#505
htuch merged 7 commits intoenvoyproxy:masterfrom
colabsaumoh:access-log

Conversation

@saumoh
Copy link
Copy Markdown
Contributor

@saumoh saumoh commented Feb 20, 2018

Title
In the proxy we've added an Unauthorized response flag. This PR adds the same to filter access logs.
Once this PR is merged it will be possible to set the flag in source/common/access_log/grpc_access_log_impl.cc
See also, comment in envoyproxy/envoy#2415

cc: @htuch
Signed-off-by: Saurabh Mohan saurabh+github@tigera.io

Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
@wora
Copy link
Copy Markdown
Contributor

wora commented Feb 20, 2018 via email

@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Feb 21, 2018

@wora fair point. I mentioned previously I was trying to address the feedback in a Envoy PR.
will close this.

@saumoh saumoh closed this Feb 21, 2018
@mattklein123
Copy link
Copy Markdown
Member

@saumoh please reopen this PR. The original feedback still stands and we need to have parity between the textual access log and gRPC access log. The field doesn't necessarily have to be a boolean in the gRPC world. It could be an enum, etc. Thanks!

@mattklein123 mattklein123 reopened this Feb 21, 2018
@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Feb 23, 2018

@wora It isn't clear to me from your comment how to address the concern that you raised.
ResponseFlag is currently setup as a set of booleans and this pr is trying to add to it.
Are you suggesting that we change to way ResponseFlag is currently setup to be an enum instead? And then we support a bitwise-OR on it so that we can set multiple flags? Or something else.
Any examples that you could share would help. Thanks!
cc @mattklein123

@mattklein123
Copy link
Copy Markdown
Member

@saumoh I think there are 2 options:

  1. Just do the PR as-is, and if we want more info on access denied reasons we can add another field later.
  2. Make this field an enum for the type of access denied, and for now just populate with a single generic default value. Then just populate that enum in code based on the existing ResponseFlag code. Then we can more easily add a more specific reason later.

I don't really have a very strong opinion either way.

Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Feb 23, 2018

@mattklein123 Appreciate the guidance and suggestion(s) on how to address this.
I've pushed a change to get some feedback on if the new way will give us the extensible format.
When we get some consensus I'll clean it up for another parse

Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
Copy link
Copy Markdown
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.

In general this approach looks great to me. I would move forward with a complete PR.


// Indicates that the request was deemed unauthorized and denied.
message Unauthorized {
bool is_unauthorized;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This bool seems redundant to me?

Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Feb 26, 2018

@mattklein123 Thanks for the feedback. I've update the PR. I kept the Unauthorized message as I felt that it will give us flexibility in case we ever want to add more information in the future. But I also don't feel too strongly about keeping it in case we want to boil it down to just the enum.

@mattklein123
Copy link
Copy Markdown
Member

@saumoh in general this LGTM. I will defer to @htuch @wora for further review. Thank you for following up on this!

// Reasons why the request was unauthorized
enum UnauthorizedType {
// Default is permitted
PERMITTED = 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be under the Unauthorized message below? That way, there is no need to have a permitted default, it can just have for default TYPE_NAME_UNSPECIFIED = 0 as per https://github.com/envoyproxy/data-plane-api/blob/master/STYLE.md?

Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>

message Unauthorized {
// Reasons why the request was unauthorized
enum UnauthorizedType {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would rename this to Reason (it's already qualified as Unauthorized by the outer scope).

}

// Indicates that the request was deemed unauthorized and denied.
Unauthorized unauthorized_denied = 13;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think maybe unauthorized_details might be a clearer name.

Saurabh Mohan added 2 commits February 28, 2018 09:47
Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
@saumoh
Copy link
Copy Markdown
Contributor Author

saumoh commented Feb 28, 2018

@htuch Thanks for the comments...indeed the naming you suggested is better! :-)

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks!

@htuch htuch merged commit 17c8a8f into envoyproxy:master Mar 1, 2018
htuch pushed a commit to envoyproxy/envoy that referenced this pull request Mar 8, 2018
Adding support for gRPC access log support for response flag Unauthorized.
Here we are adding support for envoyproxy/data-plane-api#505

Risk Level: Low
Small optional feature.

Testing:
Added UT's.

Docs Changes: N/A

Signed-off-by: Saurabh Mohan <saurabh+github@tigera.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.

4 participants