Skip to content

Commit

Permalink
support plugin audit events in web ui (#48450)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigrato authored Nov 5, 2024
1 parent a85119b commit ecd5500
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 @@ -280,6 +280,9 @@ const EventIconMap: Record<EventCode, any> = {
[eventCodes.USER_TASK_UPDATE]: Icons.Info,
[eventCodes.USER_TASK_DELETE]: Icons.Info,
[eventCodes.SFTP_SUMMARY]: Icons.FolderPlus,
[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 @@ -1834,6 +1834,27 @@ export const formatters: Formatters = {
return `User [${user}] completed a file transfer on [${server_hostname}]`;
},
},
[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 @@ -300,6 +300,9 @@ export const eventCodes = {
USER_TASK_CREATE: 'UT001I',
USER_TASK_UPDATE: 'UT002I',
USER_TASK_DELETE: 'UT003I',
PLUGIN_CREATE: 'PG001I',
PLUGIN_UPDATE: 'PG002I',
PLUGIN_DELETE: 'PG003I',
} as const;

/**
Expand Down Expand Up @@ -1693,6 +1696,18 @@ export type RawEvents = {
typeof eventCodes.USER_TASK_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 }>
>;
[eventCodes.SFTP_SUMMARY]: RawEvent<
typeof eventCodes.SFTP_SUMMARY,
{
Expand Down

0 comments on commit ecd5500

Please sign in to comment.