Skip to content

Commit 00cd8eb

Browse files
cursoragentiuwqyir
andcommitted
Add webhook secret masking and copy functionality to webhooks table
Co-authored-by: toomas <[email protected]>
1 parent 4f02f6e commit 00cd8eb

File tree

1 file changed

+33
-0
lines changed
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components

1 file changed

+33
-0
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/WebhooksTable.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ function getEventType(filters: WebhookFilters): string {
3030
return "Unknown";
3131
}
3232

33+
function maskWebhookSecret(secret: string): string {
34+
if (!secret || secret.length <= 3) {
35+
return secret;
36+
}
37+
const lastThreeChars = secret.slice(-3);
38+
const maskedPart = "*".repeat(Math.max(secret.length - 3, 8));
39+
return maskedPart + lastThreeChars;
40+
}
41+
3342
interface WebhooksTableProps {
3443
webhooks: WebhookResponse[];
3544
projectClientId: string;
@@ -127,6 +136,30 @@ export function ContractsWebhooksTable({
127136
},
128137
header: "Webhook URL",
129138
},
139+
{
140+
accessorKey: "webhook_secret",
141+
cell: ({ getValue }) => {
142+
const secret = getValue() as string;
143+
const maskedSecret = maskWebhookSecret(secret);
144+
return (
145+
<div className="flex items-center gap-2">
146+
<span className="max-w-40 truncate font-mono text-sm">
147+
{maskedSecret}
148+
</span>
149+
<CopyTextButton
150+
className="flex h-6 w-6 items-center justify-center"
151+
copyIconPosition="right"
152+
iconClassName="h-3 w-3"
153+
textToCopy={secret}
154+
textToShow=""
155+
tooltip="Copy Webhook Secret"
156+
variant="ghost"
157+
/>
158+
</div>
159+
);
160+
},
161+
header: "Webhook Secret",
162+
},
130163
{
131164
accessorKey: "created_at",
132165
cell: ({ getValue }) => {

0 commit comments

Comments
 (0)