Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

authz: Rbac engine audit logging#6225

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gtcooke94 merged 106 commits intogrpc:masterfromgtcooke94:RBACEngineAuditLogging
May 17, 2023

Conversation

gtcooke94
Copy link
Contributor

@gtcooke94gtcooke94 commentedApr 26, 2023
edited by arvindbr8
Loading

This PR adds the functionality to actually do audit logging inrbac_engine.go and associated tests for that functionality.

In addition, the audit logging spec (https://github.com/grpc/proposal/pull/346/files) requires that we have the overall policy name. It's not currently passed through the RBAC to the engine level, so we need to pipe it around. So, this PR contains some basic plumbing for that value.

In XDS, this piping will be complex and need to be its own PR. For now, XDS has a TODO and passes an empty string. This is not a loss or change of functionality since currently it is not passed anyways.

RELEASE NOTES: none

Add punctuation to commentsCo-authored-by: Arvind Bright <arvind.bright100@gmail.com>
@arvindbr8arvindbr8 added this to the1.56 Release milestoneMay 10, 2023
@arvindbr8arvindbr8 removed the request for review fromeaswarsMay 11, 2023 17:18
Copy link
Contributor

@rocksporerockspore left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@rocksporerockspore left a comment

Choose a reason for hiding this comment

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

LGTM!


func buildLogger(loggerConfig *v3rbacpb.RBAC_AuditLoggingOptions_AuditLoggerConfig) (audit.Logger, error) {
if loggerConfig.AuditLogger.TypedConfig == nil {
return nil, fmt.Errorf("AuditLogger TypedConfig cannot be nil")
Copy link
Member

Choose a reason for hiding this comment

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

Does this get plumbed back to the user somehow? I traced it back a couple levels and it's never augmented or changed. I don't think this would be a useful error message for a user. Similar with all the other errors in this function / PR - please make sure that the failure modes are understood and that the errors will make sense where they appear.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

It ends up bubbling up through theNewEngine func
Looks like that is called inauthz.NewStatic(authzPolicy string) by the user or via xds config plumbing.

I think these errors make sense in the realm of the user getting them back from calling `authz.NewStatic(.), what do you think?

Copy link
Member

@dfawleydfawleyMay 15, 2023
edited
Loading

Choose a reason for hiding this comment

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

The authz policy is a string and you're giving them errors about nil pointers. That doesn't seem right."missing required field: TypedConfig" or something?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

That makes sense, I'll reword the errors to match that. Will comment back once I push that commit

Copy link
ContributorAuthor

@gtcooke94gtcooke94May 16, 2023
edited
Loading

Choose a reason for hiding this comment

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

Reworded some, I think the others left still make sense? PTAL

Copy link
Member

Choose a reason for hiding this comment

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

When the user callsNewStatic, are they ending up here? I thought they wouldn't be using the xds protos in that case, andTypedConfig wouldn't even be a thing for them?

Copy link
ContributorAuthor

@gtcooke94gtcooke94May 16, 2023
edited
Loading

Choose a reason for hiding this comment

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

Yes - the way the golang was already structured it all pushes into these protos in the end - therbac_engine.go file is ininternal/xds and was already written to use RBAC protos directly

Copy link
Member

Choose a reason for hiding this comment

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

Does that mean this error won't ever go back out to users ofNewStatic then, because we ensure the structure is right when we come through that path?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

In theNewStatic case it will have gone throughtranslatePolicy inrbac_translator.go.
This converts from a string policy to the rbac proto.
Then that is passed along toNewChainEngine.

So checks that happen inrbac_translator.go will be guaranteed to be good by the time this path gets toNewChainEngine.

Copy link
Contributor

@rocksporerockspore left a comment

Choose a reason for hiding this comment

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

There is one more change I just realized.

Copy link
Contributor

@rocksporerockspore left a comment

Choose a reason for hiding this comment

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

Got more comments on a few subtle things that I didn't notice earlier. Sorry for any inconvenience.

@@ -304,12 +304,9 @@ func (options *auditLoggingOptions) toProtos() (allow *v3rbacpb.RBAC_AuditLoggin

for i := range options.AuditLoggers {
Copy link
Member

Choose a reason for hiding this comment

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

for _, config := range options.AuditLoggers?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Changed, I think this was a holdover from when this was structured differently.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like this is why?

range var config copies lock: google.golang.org/grpc/authz.auditLogger contains google.golang.org/protobuf/types/known/structpb.Struct contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex

Should this be[]*auditLogger then?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oh yes, I remember now that is why I had done that - changed to[]*auditLogger

Copy link
Contributor

@rocksporerockspore left a comment

Choose a reason for hiding this comment

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

Two minor comments. Otherwise LGTM. Thanks!

@dfawleydfawley removed their assignmentMay 16, 2023
@gtcooke94gtcooke94 merged commit390c392 intogrpc:masterMay 17, 2023
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsNov 14, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@easwarseaswarseaswars left review comments

@erm-germ-germ-g left review comments

@rocksporerocksporerockspore approved these changes

@arvindbr8arvindbr8arvindbr8 approved these changes

@dfawleydfawleydfawley approved these changes

Assignees

@gtcooke94gtcooke94

Labels
Status: Requires Reporter ClarificationType: SecurityA bug or other problem affecting security
Projects
None yet
Milestone
1.56 Release
Development

Successfully merging this pull request may close these issues.

6 participants
@gtcooke94@arvindbr8@easwars@rockspore@dfawley@erm-g

[8]ページ先頭

©2009-2025 Movatter.jp