Skip to content

Commit

Permalink
support plugin audit events in web ui (#48463)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigrato authored Nov 5, 2024
1 parent d32b810 commit aadbb4e
Show file tree
Hide file tree
Showing 3 changed files with 39 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 @@ -287,6 +287,9 @@ const EventIconMap: Record<EventCode, any> = {
[eventCodes.CROWN_JEWEL_CREATE]: Icons.Info,
[eventCodes.CROWN_JEWEL_UPDATE]: Icons.Info,
[eventCodes.CROWN_JEWEL_DELETE]: Icons.Info,
[eventCodes.PLUGIN_CREATE]: Icons.Info,
[eventCodes.PLUGIN_UPDATE]: Icons.Info,
[eventCodes.PLUGIN_DELETE]: Icons.Info,
[eventCodes.UNKNOWN]: Icons.Question,
};

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 @@ -1902,6 +1902,27 @@ export const formatters: Formatters = {
return `User [${user}] deleted a crown jewel [${name}]`;
},
},
[eventCodes.PLUGIN_CREATE]: {
type: 'plugin.create',
desc: 'Plugin Created',
format: ({ user, name, plugin_type }) => {
return `User [${user}] created a plugin [${name}] of type [${plugin_type}]`;
},
},
[eventCodes.PLUGIN_UPDATE]: {
type: 'plugin.update',
desc: 'Plugin Updated',
format: ({ user, name, plugin_type }) => {
return `User [${user}] updated a plugin [${name}] of type [${plugin_type}]`;
},
},
[eventCodes.PLUGIN_DELETE]: {
type: 'plugin.delete',
desc: 'Plugin Deleted',
format: ({ user, name }) => {
return `User [${user}] deleted a plugin [${name}]`;
},
},
[eventCodes.UNKNOWN]: {
type: 'unknown',
desc: 'Unknown Event',
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 @@ -307,6 +307,9 @@ export const eventCodes = {
CROWN_JEWEL_CREATE: 'CJ001I',
CROWN_JEWEL_UPDATE: 'CJ002I',
CROWN_JEWEL_DELETE: 'CJ003I',
PLUGIN_CREATE: 'PG001I',
PLUGIN_UPDATE: 'PG002I',
PLUGIN_DELETE: 'PG003I',
} as const;

/**
Expand Down Expand Up @@ -1695,6 +1698,18 @@ export type RawEvents = {
typeof eventCodes.CROWN_JEWEL_DELETE,
HasName
>;
[eventCodes.PLUGIN_CREATE]: RawEvent<
typeof eventCodes.PLUGIN_CREATE,
Merge<HasName, { plugin_type: string }>
>;
[eventCodes.PLUGIN_UPDATE]: RawEvent<
typeof eventCodes.PLUGIN_UPDATE,
Merge<HasName, { plugin_type: string }>
>;
[eventCodes.PLUGIN_DELETE]: RawEvent<
typeof eventCodes.PLUGIN_DELETE,
Merge<HasName, { user: string }>
>;
};

/**
Expand Down

0 comments on commit aadbb4e

Please sign in to comment.