mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: audit login (#5925)
* added migration for api key resource * sort of working * auditing login * passing the correct user id * added and fixed tests * gen documentation * formatting and lint * lint * audit Github oauth and write tests * audit oauth and write tests * added defer fn for login error auditing * fixed test * feat: audit logout (#5998) * Update coderd/userauth.go Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com> * fix test * bypassing diff generation if login/logout * lint --------- Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
This commit is contained in:
@ -270,8 +270,8 @@ func TestPostWorkspacesByOrganization(t *testing.T) {
|
||||
coderdtest.AwaitTemplateVersionJob(t, client, version.ID)
|
||||
_ = coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
|
||||
|
||||
require.Len(t, auditor.AuditLogs, 4)
|
||||
assert.Equal(t, database.AuditActionCreate, auditor.AuditLogs[3].Action)
|
||||
require.Len(t, auditor.AuditLogs, 5)
|
||||
assert.Equal(t, database.AuditActionCreate, auditor.AuditLogs[4].Action)
|
||||
})
|
||||
|
||||
t.Run("CreateWithDeletedTemplate", func(t *testing.T) {
|
||||
@ -1283,8 +1283,8 @@ func TestWorkspaceUpdateAutostart(t *testing.T) {
|
||||
interval := next.Sub(testCase.at)
|
||||
require.Equal(t, testCase.expectedInterval, interval, "unexpected interval")
|
||||
|
||||
require.Len(t, auditor.AuditLogs, 6)
|
||||
assert.Equal(t, database.AuditActionWrite, auditor.AuditLogs[5].Action)
|
||||
require.Len(t, auditor.AuditLogs, 7)
|
||||
assert.Equal(t, database.AuditActionWrite, auditor.AuditLogs[6].Action)
|
||||
})
|
||||
}
|
||||
|
||||
@ -1398,8 +1398,8 @@ func TestWorkspaceUpdateTTL(t *testing.T) {
|
||||
|
||||
require.Equal(t, testCase.ttlMillis, updated.TTLMillis, "expected autostop ttl to equal requested")
|
||||
|
||||
require.Len(t, auditor.AuditLogs, 6)
|
||||
assert.Equal(t, database.AuditActionWrite, auditor.AuditLogs[5].Action)
|
||||
require.Len(t, auditor.AuditLogs, 7)
|
||||
assert.Equal(t, database.AuditActionWrite, auditor.AuditLogs[6].Action)
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user