Skip to content

Commit

Permalink
Allow explicit inclusion of audit traces. (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored Aug 23, 2023
1 parent 190419c commit f93faf7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions auditing/auditing-interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import (
)

const (
// Include explicitly includes the request to the auditing backend even if the request method would prevent the request to be audited (only applies for the http filter)
Include string = "include-to-auditing"
// Exclude explicitly excludes the request to the auditing backend even if the request method would audit the request (only applies for the http filter)
Exclude string = "exclude-from-auditing"
)

Expand Down Expand Up @@ -297,8 +300,13 @@ func HttpFilter(a Auditing, logger *zap.SugaredLogger) restful.FilterFunction {
case http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete:
break
default:
chain.ProcessFilter(request, response)
return
included, ok := request.SelectedRoute().Metadata()[Include].(bool)
if ok && included {
break
} else {
chain.ProcessFilter(request, response)
return
}
}

excluded, ok := request.SelectedRoute().Metadata()[Exclude].(bool)
Expand Down

0 comments on commit f93faf7

Please sign in to comment.