Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v15] Truncate access request list of search roles on audit page. #39372

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5373,7 +5373,7 @@ exports[`list of all events 1`] = `
<td
style="word-break: break-word;"
>
User [foo] searched for resource type [db_server] with role(s) [admin]
User [foo] searched for resource type [db_server] with role(s) [admin,really-long-role-name-1,really-long-role-name-2,really-long-role-name-3...]
</td>
<td
style="min-width: 120px;"
Expand Down
13 changes: 12 additions & 1 deletion web/packages/teleport/src/Audit/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,18 @@ export const events = [
event: 'access_request.search',
namespace: 'default',
resource_type: 'db_server',
search_as_roles: ['admin'],
search_as_roles: [
'admin',
'really-long-role-name-1',
'really-long-role-name-2',
'really-long-role-name-3',
'really-long-role-name-4',
'really-long-role-name-5',
'really-long-role-name-6',
'really-long-role-name-7',
'really-long-role-name-8',
'really-long-role-name-9',
],
time: '2022-06-08T15:10:35.368Z',
uid: 'b13d61-b97-475f-86ef-1fedf',
user: 'foo',
Expand Down
2 changes: 1 addition & 1 deletion web/packages/teleport/src/services/audit/makeEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const formatters: Formatters = {
type: 'access_request.search',
desc: 'Resource Access Search',
format: ({ user, resource_type, search_as_roles }) =>
`User [${user}] searched for resource type [${resource_type}] with role(s) [${search_as_roles}]`,
`User [${user}] searched for resource type [${resource_type}] with role(s) [${truncateStr(search_as_roles.join(','), 80)}]`,
},
[eventCodes.SESSION_COMMAND]: {
type: 'session.command',
Expand Down
2 changes: 1 addition & 1 deletion web/packages/teleport/src/services/audit/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export type RawEvents = {
>;
[eventCodes.ACCESS_REQUEST_RESOURCE_SEARCH]: RawEvent<
typeof eventCodes.ACCESS_REQUEST_RESOURCE_SEARCH,
{ resource_type: string; search_as_roles: string }
{ resource_type: string; search_as_roles: string[] }
>;
[eventCodes.AUTH_ATTEMPT_FAILURE]: RawEventAuthFailure<
typeof eventCodes.AUTH_ATTEMPT_FAILURE
Expand Down