Skip to content

Commit

Permalink
[v17] Add frontend support for WorkloadIdentity audit log events (#50020
Browse files Browse the repository at this point in the history
)

* Add support for WorkloadIdentity events to audit log

* Prettier
  • Loading branch information
strideynet authored Dec 11, 2024
1 parent 434077a commit c0d5a6f
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
3 changes: 3 additions & 0 deletions web/packages/teleport/src/Audit/EventList/EventTypeCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ const EventIconMap: Record<EventCode, any> = {
[eventCodes.BOT_CREATED]: Icons.Info,
[eventCodes.BOT_UPDATED]: Icons.Info,
[eventCodes.BOT_DELETED]: Icons.Info,
[eventCodes.WORKLOAD_IDENTITY_CREATE]: Icons.Info,
[eventCodes.WORKLOAD_IDENTITY_UPDATE]: Icons.Info,
[eventCodes.WORKLOAD_IDENTITY_DELETE]: Icons.Info,
[eventCodes.RESET_PASSWORD_TOKEN_CREATED]: Icons.Info,
[eventCodes.USER_PASSWORD_CHANGED]: Icons.Info,
[eventCodes.ACCESS_REQUEST_CREATED]: Icons.Info,
Expand Down
33 changes: 33 additions & 0 deletions web/packages/teleport/src/Audit/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3509,6 +3509,39 @@ export const events = [
uid: '0efbb33d-fa50-44e0-8dec-4ac89c0dd4ab',
user: 'noah',
},
{
cluster_name: 'leaf.tele.ottr.sh:443',
code: 'WID001I',
ei: 0,
event: 'workload_identity.create',
expires: '0001-01-01T00:00:00Z',
name: 'made-by-noah',
time: '2023-12-08T10:53:39.798Z',
uid: '0efbb33d-fa50-44e0-8dec-4ac89c0dd4ab',
user: 'noah',
},
{
cluster_name: 'leaf.tele.ottr.sh:443',
code: 'WID002I',
ei: 0,
event: 'workload_identity.update',
expires: '0001-01-01T00:00:00Z',
name: 'made-by-noah',
time: '2023-12-08T10:53:39.798Z',
uid: '0efbb33d-fa50-44e0-8dec-4ac89c0dd4ab',
user: 'noah',
},
{
cluster_name: 'leaf.tele.ottr.sh:443',
code: 'WID003I',
ei: 0,
event: 'workload_identity.delete',
expires: '0001-01-01T00:00:00Z',
name: 'made-by-noah',
time: '2023-12-08T10:53:39.798Z',
uid: '0efbb33d-fa50-44e0-8dec-4ac89c0dd4ab',
user: 'noah',
},
{
'addr.remote': '127.0.0.1:54378',
cluster_name: 'leaf.tele.ottr.sh',
Expand Down
21 changes: 21 additions & 0 deletions web/packages/teleport/src/services/audit/makeEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,27 @@ export const formatters: Formatters = {
return `User [${user}] deleted a Bot [${name}]`;
},
},
[eventCodes.WORKLOAD_IDENTITY_CREATE]: {
type: 'workload_identity.create',
desc: 'Workload Identity Created',
format: ({ user, name }) => {
return `User [${user}] created a Workload Identity [${name}]`;
},
},
[eventCodes.WORKLOAD_IDENTITY_UPDATE]: {
type: 'workload_identity.update',
desc: 'Workload Identity Updated',
format: ({ user, name }) => {
return `User [${user}] updated a Workload Identity [${name}]`;
},
},
[eventCodes.WORKLOAD_IDENTITY_DELETE]: {
type: 'workload_identity.delete',
desc: 'Workload Identity Deleted',
format: ({ user, name }) => {
return `User [${user}] deleted a Workload Identity [${name}]`;
},
},
[eventCodes.LOGIN_RULE_CREATE]: {
type: 'login_rule.create',
desc: 'Login Rule Created',
Expand Down
15 changes: 15 additions & 0 deletions web/packages/teleport/src/services/audit/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ export const eventCodes = {
BOT_CREATED: 'TB001I',
BOT_UPDATED: 'TB002I',
BOT_DELETED: 'TB003I',
WORKLOAD_IDENTITY_CREATE: `WID001I`,
WORKLOAD_IDENTITY_UPDATE: `WID002I`,
WORKLOAD_IDENTITY_DELETE: `WID003I`,
LOGIN_RULE_CREATE: 'TLR00I',
LOGIN_RULE_DELETE: 'TLR01I',
SAML_IDP_AUTH_ATTEMPT: 'TSI000I',
Expand Down Expand Up @@ -1323,6 +1326,18 @@ export type RawEvents = {
[eventCodes.BOT_CREATED]: RawEvent<typeof eventCodes.BOT_CREATED, HasName>;
[eventCodes.BOT_UPDATED]: RawEvent<typeof eventCodes.BOT_UPDATED, HasName>;
[eventCodes.BOT_DELETED]: RawEvent<typeof eventCodes.BOT_DELETED, HasName>;
[eventCodes.WORKLOAD_IDENTITY_CREATE]: RawEvent<
typeof eventCodes.WORKLOAD_IDENTITY_CREATE,
HasName
>;
[eventCodes.WORKLOAD_IDENTITY_UPDATE]: RawEvent<
typeof eventCodes.WORKLOAD_IDENTITY_UPDATE,
HasName
>;
[eventCodes.WORKLOAD_IDENTITY_DELETE]: RawEvent<
typeof eventCodes.WORKLOAD_IDENTITY_DELETE,
HasName
>;
[eventCodes.LOGIN_RULE_CREATE]: RawEvent<
typeof eventCodes.LOGIN_RULE_CREATE,
HasName
Expand Down

0 comments on commit c0d5a6f

Please sign in to comment.