diff --git a/site/src/components/AuditLogRow/AuditLogDiff.tsx b/site/src/components/AuditLogRow/AuditLogDiff.tsx index ef3629e5b0c1f..640bcda7378b9 100644 --- a/site/src/components/AuditLogRow/AuditLogDiff.tsx +++ b/site/src/components/AuditLogRow/AuditLogDiff.tsx @@ -41,7 +41,7 @@ export const AuditLogDiff: FC<{ diff: AuditLog["diff"] }> = ({ diff }) => { styles.diffValueOld, ])} > - {getDiffValue(valueDiff.old)} + {valueDiff.secret ? "••••••••" : getDiffValue(valueDiff.old)} @@ -60,7 +60,7 @@ export const AuditLogDiff: FC<{ diff: AuditLog["diff"] }> = ({ diff }) => { styles.diffValueNew, ])} > - {getDiffValue(valueDiff.new)} + {valueDiff.secret ? "••••••••" : getDiffValue(valueDiff.new)} diff --git a/site/src/components/AuditLogRow/AuditLogRow.stories.tsx b/site/src/components/AuditLogRow/AuditLogRow.stories.tsx index 7d73efd47b3e5..4e75cb7a747ef 100644 --- a/site/src/components/AuditLogRow/AuditLogRow.stories.tsx +++ b/site/src/components/AuditLogRow/AuditLogRow.stories.tsx @@ -10,6 +10,7 @@ import { MockAuditLog2, MockAuditLogWithWorkspaceBuild, MockAuditLogWithDeletedResource, + MockAuditLogGitSSH, } from "testHelpers/entities" import { AuditLogRow, AuditLogRowProps } from "./AuditLogRow" @@ -72,3 +73,8 @@ export const DeletedResource = Template.bind({}) DeletedResource.args = { auditLog: MockAuditLogWithDeletedResource, } + +export const SecretDiffValue = Template.bind({}) +SecretDiffValue.args = { + auditLog: MockAuditLogGitSSH, +} diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index 7b1b247e3d36d..02efc7aca69d0 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -1066,6 +1066,22 @@ export const MockAuditLogWithDeletedResource: TypesGen.AuditLog = { is_deleted: true, } +export const MockAuditLogGitSSH: TypesGen.AuditLog = { + ...MockAuditLog, + diff: { + private_key: { + old: "", + new: "", + secret: true, + }, + public_key: { + old: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRUPjBSNtOAnL22+r07OSu9t3Lnm8/5OX8bRHECKS9g\n", + new: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEwoUPJPMekuSzMZyV0rA82TGGNzw/Uj/dhLbwiczTpV\n", + secret: false, + }, + }, +} + export const MockWorkspaceQuota: TypesGen.WorkspaceQuota = { credits_consumed: 0, budget: 100,