Skip to content

Commit

Permalink
Fix DB Query always return success false in audit log (#23270)
Browse files Browse the repository at this point in the history
* Initialize db query to status of success true

* Init event status as success true
  • Loading branch information
stevenGravy authored Mar 18, 2023
1 parent 202a474 commit b4e1f39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/srv/db/common/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ func (a *audit) OnQuery(ctx context.Context, session *Session, query Query) {
DatabaseMetadata: MakeDatabaseMetadata(session),
DatabaseQuery: query.Query,
DatabaseQueryParameters: query.Parameters,
Status: events.Status{
Success: true,
},
}
if query.Database != "" {
event.DatabaseMetadata.DatabaseName = query.Database
Expand Down
3 changes: 3 additions & 0 deletions lib/srv/db/sqlserver/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ func TestHandleConnectionAuditEvents(t *testing.T) {
Code: libevents.DatabaseSessionQueryCode,
},
DatabaseQuery: "\nselect 'foo' as 'bar'\n ",
Status: events.Status{
Success: true,
},
}),
},
},
Expand Down

0 comments on commit b4e1f39

Please sign in to comment.