Skip to content

authz: Stdout logger#6230

Merged
erm-g merged 30 commits into
grpc:masterfrom
erm-g:AuditLoggerRegistry
May 17, 2023
Merged

authz: Stdout logger#6230
erm-g merged 30 commits into
grpc:masterfrom
erm-g:AuditLoggerRegistry

Conversation

@erm-g

@erm-g erm-g commented Apr 28, 2023

Copy link
Copy Markdown
Contributor

Part of RBAC audit logging effort for authz. The functionality in this PR includes a built in StdOut logger (prints the whole Event to stdout in json format)

RELEASE NOTES:

  • TBD

@linux-foundation-easycla

linux-foundation-easycla Bot commented Apr 28, 2023

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

@erm-g erm-g requested review from gtcooke94 and rockspore April 28, 2023 03:38

@gtcooke94 gtcooke94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good start, I think we definitely want to split this into a PR for the stdout logger and a PR for XDS registry and parsing, then title them accordingly

Comment thread authz/audit/stdout_logger.go Outdated
Comment thread authz/audit/stdout_logger.go Outdated
Comment thread authz/audit/stdout_logger.go Outdated
Comment thread authz/audit/stdout_logger.go Outdated
Comment thread authz/audit/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout_logger_test.go Outdated
Comment thread xds/internal/httpfilter/rbac/audit/audit_logger.go Outdated

@rockspore rockspore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR. Left some comments. Also suggest simply some variable names following Go's style. Please follow existing code in the repo to do logging instead of fmt.Println

Comment thread authz/audit/stdout_logger.go Outdated
Comment thread authz/audit/stdout_logger.go Outdated
Comment thread authz/audit/stdout_logger.go Outdated
Comment thread authz/audit/stdout_logger.go Outdated
Comment thread authz/audit/stdout_logger.go Outdated
Comment thread authz/audit/stdout_logger.go Outdated
Comment thread xds/internal/httpfilter/rbac/audit/audit_logger.go Outdated
@rockspore rockspore changed the title Audit logger registry authz: Audit logger registry Apr 28, 2023
@erm-g erm-g marked this pull request as ready for review May 8, 2023 02:14
@erm-g erm-g changed the title authz: Audit logger registry authz: Stdout logger May 8, 2023
@erm-g erm-g requested review from gtcooke94 and rockspore May 8, 2023 16:18

@gtcooke94 gtcooke94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! Have a few comments and some golang convention items to change

Comment thread authz/audit/audit_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated

@gtcooke94 gtcooke94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! Have a few comments and some golang convention items to change

@erm-g erm-g added the Type: Security A bug or other problem affecting security label May 9, 2023
@easwars

easwars commented May 10, 2023

Copy link
Copy Markdown
Contributor

@erm-g Please don't mark comment threads as resolved. The policy we follow is that the reviewer marks them as resolved, once they feel that the comment has been appropriately addressed. It's a pain to unresolve every comment and see if they have been addressed appropriately. Thanks.

Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go
Comment thread authz/audit/stdout/stdout_logger_test.go
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
erm-g added 2 commits May 14, 2023 03:56
…ger struct func. Add timestamp testing logic. Add registry presense test.
@erm-g erm-g requested a review from rockspore May 15, 2023 03:03
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go
@easwars

easwars commented May 15, 2023

Copy link
Copy Markdown
Contributor

@erm-g : Looks like there are more comments from the security team here. Please let me know once you have addressed all of them, and want me to take another pass. Thanks.

Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
@erm-g erm-g requested a review from rockspore May 16, 2023 02:16
Comment thread authz/audit/stdout/stdout_logger.go
Comment thread authz/audit/stdout/stdout_logger_test.go Outdated
Comment thread authz/audit/stdout/stdout_logger_test.go
Comment thread authz/audit/stdout/stdout_logger.go Outdated

@rockspore rockspore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One nit was not resolved yet. The rest LGTM! Thanks.

Comment on lines +70 to +71
l := log.New(&buf, "", 0)
builder := &loggerBuilder{goLogger: l}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: inline l into the next line.

builder := &loggerBuilder{goLogger: l}
auditLogger := builder.Build(nil)
auditLogger.Log(test.event)
var container map[string]interface{}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: Consider adding newlines to logically separate the steps of the test. At the very least, it would be good to separate out the following steps using newlines: setup, actual test logic, verification.

@easwars

easwars commented May 16, 2023

Copy link
Copy Markdown
Contributor

LGTM. Some very minor nits. Feel free to merge without another pass from me.

@erm-g erm-g merged commit 52fef6d into grpc:master May 17, 2023
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Type: Feature New features or improvements in behavior Type: Security A bug or other problem affecting security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants