Events: Add outbound detail protobufs, request status code, and update event encrypt filter. (#1569)
* feat (events): Add status code to audit events * feat (events): Add the resp proto msg to every audit event * chore (events): Update eventlogger dep This latest version will redact any map and/or map field which isn't explicitly classified via a Taggable interface * feat (events): Begin to add tagging to response proto msgs
This commit is contained in:
23 files changed
+914
-129
No files matched your search
@@ -30,16 +30,15 @@ const (
|
||||
)
|
||||
|
||||
type testAudit struct {
|
||||
Id string `json:"id"` // std audit/boundary field
|
||||
Version string `json:"version"` // std audit/boundary field
|
||||
Type string `json:"type"` // std audit field
|
||||
Timestamp time.Time `json:"timestamp"` // std audit field
|
||||
RequestInfo *event.RequestInfo `json:"request_info,omitempty"` // boundary field
|
||||
Auth *event.Auth `json:"auth,omitempty"` // std audit field
|
||||
Request *event.Request `json:"request,omitempty"` // std audit field
|
||||
Response *event.Response `json:"response,omitempty"` // std audit field
|
||||
SerializedHMAC string `json:"serialized_hmac"` // boundary field
|
||||
Flush bool `json:"-"`
|
||||
Id string `json:"id"` // std audit/boundary field
|
||||
Version string `json:"version"` // std audit/boundary field
|
||||
Type string `json:"type"` // std audit field
|
||||
Timestamp time.Time `json:"timestamp"` // std audit field
|
||||
RequestInfo *event.RequestInfo `json:"request_info,omitempty"` // boundary field
|
||||
Auth *event.Auth `json:"auth,omitempty"` // std audit field
|
||||
Request *event.Request `json:"request,omitempty"` // std audit field
|
||||
Response *event.Response `json:"response,omitempty"` // std audit field
|
||||
Flush bool `json:"-"`
|
||||
}
|
||||
|
||||
func Test_NewRequestInfoContext(t *testing.T) {
|
||||
@@ -922,13 +921,12 @@ func Test_WriteAudit(t *testing.T) {
|
||||
Time: gotAudit.Time,
|
||||
Type: "audit",
|
||||
Data: map[string]interface{}{
|
||||
"auth": tt.wantAudit.Auth,
|
||||
"id": gotAudit.Data.(map[string]interface{})["id"],
|
||||
"timestamp": now,
|
||||
"request": tt.wantAudit.Request,
|
||||
"serialized_hmac": "",
|
||||
"type": apiRequest,
|
||||
"version": testAuditVersion,
|
||||
"auth": tt.wantAudit.Auth,
|
||||
"id": gotAudit.Data.(map[string]interface{})["id"],
|
||||
"timestamp": now,
|
||||
"request": tt.wantAudit.Request,
|
||||
"type": apiRequest,
|
||||
"version": testAuditVersion,
|
||||
},
|
||||
}
|
||||
if tt.wantAudit.Id != "" {
|
||||
|
||||
@@ -19,16 +19,15 @@ const (
|
||||
|
||||
// audit defines the data of audit events
|
||||
type audit struct {
|
||||
Id string `json:"id"` // std audit/boundary field
|
||||
Version string `json:"version"` // std audit/boundary field
|
||||
Type string `json:"type"` // std audit field
|
||||
Timestamp time.Time `json:"timestamp"` // std audit field
|
||||
RequestInfo *RequestInfo `json:"request_info,omitempty"` // boundary field
|
||||
Auth *Auth `json:"auth,omitempty"` // std audit field
|
||||
Request *Request `json:"request,omitempty"` // std audit field
|
||||
Response *Response `json:"response,omitempty"` // std audit field
|
||||
SerializedHMAC string `json:"serialized_hmac"` // boundary field
|
||||
Flush bool `json:"-"`
|
||||
Id string `json:"id"` // std audit/boundary field
|
||||
Version string `json:"version"` // std audit/boundary field
|
||||
Type string `json:"type"` // std audit field
|
||||
Timestamp time.Time `json:"timestamp"` // std audit field
|
||||
RequestInfo *RequestInfo `json:"request_info,omitempty"` // boundary field
|
||||
Auth *Auth `json:"auth,omitempty"` // std audit field
|
||||
Request *Request `json:"request,omitempty"` // std audit field
|
||||
Response *Response `json:"response,omitempty"` // std audit field
|
||||
Flush bool `json:"-"`
|
||||
}
|
||||
|
||||
func newAudit(fromOperation Op, opt ...Option) (*audit, error) {
|
||||
@@ -133,7 +132,15 @@ func (a *audit) ComposeFrom(events []*eventlogger.Event) (eventlogger.EventType,
|
||||
payload.Request = gated.Request
|
||||
}
|
||||
if gated.Response != nil {
|
||||
payload.Response = gated.Response
|
||||
if payload.Response == nil {
|
||||
payload.Response = &Response{}
|
||||
}
|
||||
if gated.Response.StatusCode != 0 {
|
||||
payload.Response.StatusCode = gated.Response.StatusCode
|
||||
}
|
||||
if gated.Response.Details != nil {
|
||||
payload.Response.Details = gated.Response.Details
|
||||
}
|
||||
}
|
||||
if !gated.Timestamp.IsZero() {
|
||||
payload.Timestamp = gated.Timestamp
|
||||
|
||||
Reference in new issue
Block a user