Skip to content

feat: better display secret audit values #5801

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
Jan 19, 2023
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
4 changes: 2 additions & 2 deletions site/src/components/AuditLogRow/AuditLogDiff.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const AuditLogDiff: FC<{ diff: AuditLog["diff"] }> = ({ diff }) => {
styles.diffValueOld,
])}
>
{getDiffValue(valueDiff.old)}
{valueDiff.secret ? "••••••••" : getDiffValue(valueDiff.old)}
</span>
</div>
</div>
Expand All @@ -60,7 +60,7 @@ export const AuditLogDiff: FC<{ diff: AuditLog["diff"] }> = ({ diff }) => {
styles.diffValueNew,
])}
>
{getDiffValue(valueDiff.new)}
{valueDiff.secret ? "••••••••" : getDiffValue(valueDiff.new)}
</span>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions site/src/components/AuditLogRow/AuditLogRow.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
MockAuditLog2,
MockAuditLogWithWorkspaceBuild,
MockAuditLogWithDeletedResource,
MockAuditLogGitSSH,
} from "testHelpers/entities"
import { AuditLogRow, AuditLogRowProps } from "./AuditLogRow"

Expand Down Expand Up @@ -72,3 +73,8 @@ export const DeletedResource = Template.bind({})
DeletedResource.args = {
auditLog: MockAuditLogWithDeletedResource,
}

export const SecretDiffValue = Template.bind({})
SecretDiffValue.args = {
auditLog: MockAuditLogGitSSH,
}
16 changes: 16 additions & 0 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down