Skip to content
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

Add backend type to audit logs #9167

Merged
merged 14 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions audit/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ func (f *AuditFormatter) FormatResponse(ctx context.Context, w io.Writer, config
},

Response: &AuditResponse{
Backend: in.BackendType,
Auth: respAuth,
Secret: respSecret,
Data: resp.Data,
Expand Down Expand Up @@ -350,6 +351,7 @@ type AuditRequest struct {

type AuditResponse struct {
Auth *AuditAuth `json:"auth,omitempty"`
Backend string `json:"backend,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd feel a little bit better if it was backend_type, but I'm also worried that "backend" is new terminology for an end user? We generally refer to "secret engine" or "auth method" but the documentation does mention "backend" as a concept too.

I looked for other examples in our API or audit entries. Mount status has just "type".

The new metrics use auth_method or secret_engine, because I split usage so they didn't overlap.

backend_type seems preferable to be clearer that it's not the mount point or path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Trying MountType instead, thoughts?

Secret *AuditSecret `json:"secret,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
Warnings []string `json:"warnings,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions sdk/logical/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type LogInput struct {
Auth *Auth
Request *Request
Response *Response
BackendType string
OuterErr error
NonHMACReqDataKeys []string
NonHMACRespDataKeys []string
Expand Down
1 change: 1 addition & 0 deletions vault/request_handling.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ func (c *Core) handleCancelableRequest(ctx context.Context, ns *namespace.Namesp
Auth: auth,
Request: req,
Response: auditResp,
BackendType: entry.Type,
OuterErr: err,
NonHMACReqDataKeys: nonHMACReqDataKeys,
NonHMACRespDataKeys: nonHMACRespDataKeys,
Expand Down