Skip to content

refactor: name null users in audit logs #16890

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

Merged
merged 1 commit into from
Mar 12, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,12 @@ export const SCIMUpdateUser: Story = {
},
},
};

export const UnauthenticatedUser: Story = {
args: {
auditLog: {
...MockAuditLog,
user: null,
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export const AuditLogDescription: FC<AuditLogDescriptionProps> = ({
}

let target = auditLog.resource_target.trim();
let user = auditLog.user?.username.trim();
let user = auditLog.user
? auditLog.user.username.trim()
: "Unauthenticated user";

// SSH key entries have no links
if (auditLog.resource_type === "git_ssh_key") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const BuildAuditDescription: FC<BuildAuditDescriptionProps> = ({
auditLog.additional_fields?.build_reason &&
auditLog.additional_fields?.build_reason !== "initiator"
? "Coder automatically"
: auditLog.user?.username.trim();
: auditLog.user
? auditLog.user.username.trim()
: "Unauthenticated user";

const action = useMemo(() => {
switch (auditLog.action) {
Expand Down
Loading