From 32add5f602909e177b58421430c0a4cce69db49b Mon Sep 17 00:00:00 2001 From: iuwqyir Date: Tue, 15 Jul 2025 19:59:09 +0000 Subject: [PATCH] Display webhook secret in dashboard (#7610) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ``` --- [Slack Thread](https://thirdwebdev.slack.com/archives/C085X0VQCF3/p1752487882125419?thread_ts=1752487882.125419&cid=C085X0VQCF3) --- ## PR-Codex overview This PR introduces a new function to mask webhook secrets for improved security and updates the `WebhooksTable` component to display the masked secret while allowing users to copy the original secret. ### Detailed summary - Added `maskWebhookSecret` function to mask webhook secrets. - Updated `WebhooksTable` to include a new column for "Webhook Secret." - Displayed masked secret in the table with an option to copy the original secret. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit * **New Features** * Added a new "Webhook Secret" column to the webhooks table, displaying masked webhook secrets for improved privacy. * Included a copy button to easily copy the full unmasked webhook secret to the clipboard. --- .../webhooks/components/WebhooksTable.tsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/WebhooksTable.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/WebhooksTable.tsx index d715486f32b..a569aa88469 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/WebhooksTable.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/WebhooksTable.tsx @@ -30,6 +30,15 @@ function getEventType(filters: WebhookFilters): string { return "Unknown"; } +function maskWebhookSecret(secret: string): string { + if (!secret || secret.length <= 3) { + return secret; + } + const lastThreeChars = secret.slice(-3); + const maskedPart = "*".repeat(10); + return maskedPart + lastThreeChars; +} + interface WebhooksTableProps { webhooks: WebhookResponse[]; projectClientId: string; @@ -127,6 +136,30 @@ export function ContractsWebhooksTable({ }, header: "Webhook URL", }, + { + accessorKey: "webhook_secret", + cell: ({ getValue }) => { + const secret = getValue() as string; + const maskedSecret = maskWebhookSecret(secret); + return ( +
+ + {maskedSecret} + + +
+ ); + }, + header: "Webhook Secret", + }, { accessorKey: "created_at", cell: ({ getValue }) => {