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

VAULT-24798: audit - improve error messages #26312

Merged
merged 18 commits into from
Apr 11, 2024

Conversation

peteski22
Copy link
Contributor

This PR removes the op which was formerly part of all error messages in the audit sub-system.

The idea is to make the errors we show to the user expose less of the guts of Vault (no mention of file.Factory etc.).

It defines some typed errors which are used with wrapping to try and give us an idea of what was happening (audit/errors.go), including if we want to return a more generic error to the caller (for the case of internal errors).

Some receipts for the changes:

image

image

ENT PR: https://github.com/hashicorp/vault-enterprise/pull/5688

@peteski22 peteski22 added core/audit pr/no-changelog hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed labels Apr 9, 2024
@peteski22 peteski22 added this to the 1.16.2 milestone Apr 9, 2024
@peteski22 peteski22 requested review from ccapurso and kubawi April 9, 2024 09:53
Copy link

github-actions bot commented Apr 9, 2024

CI Results:
All Go tests succeeded! ✅

Copy link

github-actions bot commented Apr 9, 2024

Build Results:
All builds succeeded! ✅

@peteski22 peteski22 changed the title audit: remove 'op' from error messages and do some clean up VAULT-24798: audit - improve error messages Apr 9, 2024
sdk/go.sum Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

go mod tidy not sure why this got fiddled with though.

@@ -36,34 +35,92 @@ type timeProvider interface {
formattedTime() string
}

// FormatterConfig is used to provide basic configuration to a formatter.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FormatterConfig is moved from audit/types.go

type EntryFormatter struct {
config FormatterConfig
salter Salter
logger hclog.Logger
name string
}

// NewFormatterConfig should be used to create a FormatterConfig.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NewFormatterConfig is moved up from lower down in the file.

Copy link
Contributor

@ccapurso ccapurso left a comment

Choose a reason for hiding this comment

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

This looks good, definitely a bit easier to consume these error messages!

@peteski22 peteski22 merged commit 3dc16db into main Apr 11, 2024
82 of 83 checks passed
@peteski22 peteski22 deleted the peteski22/VAULT-24798/audit-error-messages-again branch April 11, 2024 08:09
@peteski22 peteski22 modified the milestones: 1.16.2, 1.17.0-rc Apr 11, 2024
@peteski22 peteski22 removed this from the 1.16.2 milestone Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core/audit hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed pr/no-changelog pr/no-milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants