Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
lint
  • Loading branch information
Kira-Pilot committed Feb 6, 2023
commit 9bfc125df00cb627ba08b8fe0e27a1eb8c7584f0
14 changes: 6 additions & 8 deletions coderd/audit/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@ func InitRequest[T Auditable](w http.ResponseWriter, p *RequestParams) (*Request

// If no resources were provided, there's nothing we can audit.
if ResourceID(req.Old) == uuid.Nil && ResourceID(req.New) == uuid.Nil {
if req.params.Action == database.AuditActionLogin ||
req.params.Action == database.AuditActionLogout {
// If the request action is a login or logout, we always want to audit it even if
// there is no diff. This is so we can capture events where an API Key is never created
// because an unknown user fails to login.
// TODO: introduce the concept of an anonymous user so we always have a userID even
// when dealing with a mystery user. https://github.com/coder/coder/issues/6054
} else {
// If the request action is a login or logout, we always want to audit it even if
// there is no diff. This is so we can capture events where an API Key is never created
// because an unknown user fails to login.
// TODO: introduce the concept of an anonymous user so we always have a userID even
// when dealing with a mystery user. https://github.com/coder/coder/issues/6054
if req.params.Action != database.AuditActionLogin && req.params.Action != database.AuditActionLogout {
return
}
}
Expand Down