The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Expand API log route coverage and mask token/webhook secrets
Kiran K181e05084dd4
diff --git a/apps/web/lib/api-logs/constants.ts b/apps/web/lib/api-logs/constants.tsindex ebd15003ce..2de88f64f9 100644--- a/apps/web/lib/api-logs/constants.ts+++ b/apps/web/lib/api-logs/constants.ts@@ -13,7 +13,8 @@ export const PUBLISHABLE_KEY_REQUEST_PATHS = [] as const;// Route patterns for parameterized path matching.-// Used both for logging eligibility and route pattern extraction.+// Also the allowlist for which mutation routes are recorded in API logs.+// Used for route_pattern extraction and sensitive-field masking keys.// Order matters: more specific patterns must come before less specific ones.export const ROUTE_PATTERNS = [// Track@@ -35,6 +36,7 @@ export const ROUTE_PATTERNS = [// Links"/links/bulk","/links/upsert",+ "/links/:linkId/transfer","/links/:linkId","/links",@@ -50,9 +52,73 @@ export const ROUTE_PATTERNS = [// Bounties"/bounties/:bountyId/submissions/:submissionId/approve","/bounties/:bountyId/submissions/:submissionId/reject",+ "/bounties/:bountyId/sync-social-metrics",+ "/bounties/:bountyId",+ "/bounties",++ // Campaigns+ "/campaigns/:campaignId/duplicate",+ "/campaigns/:campaignId/preview",+ "/campaigns/:campaignId",+ "/campaigns",++ // Folders+ "/folders/:folderId",+ "/folders",++ // Domains+ "/domains/client/register",+ "/domains/client/saved",+ "/domains/default",+ "/domains/register",+ "/domains/:domain/primary",+ "/domains/:domain/transfer",+ "/domains/:domain",+ "/domains",++ // Tags+ "/tags/:id",+ "/tags",// Tokens"/tokens/embed/referrals",+ "/tokens/:id",+ "/tokens",++ // Webhooks+ "/webhooks/:webhookId",+ "/webhooks",++ // UTM+ "/utm/:id",+ "/utm",++ // Dashboards+ "/dashboards/:id",+ "/dashboards",++ // Groups+ "/groups/:groupIdOrSlug/default-links/:defaultLinkId",+ "/groups/:groupIdOrSlug/default-links",+ "/groups/:groupIdOrSlug/default",+ "/groups/:groupIdOrSlug/partners",+ "/groups/:groupIdOrSlug",+ "/groups",++ // Discount codes+ "/discount-codes/:discountCodeId",+ "/discount-codes",++ // Email domains+ "/email-domains/:domain",+ "/email-domains",++ // OAuth+ "/oauth/apps/:appId",+ "/oauth/apps",++ // Workspaces+ "/workspaces/:id",] as const;export const REQUEST_TYPES = [diff --git a/apps/web/lib/api-logs/mask-sensitive-fields.ts b/apps/web/lib/api-logs/mask-sensitive-fields.tsindex cc46b5c009..4d8205abf4 100644--- a/apps/web/lib/api-logs/mask-sensitive-fields.ts+++ b/apps/web/lib/api-logs/mask-sensitive-fields.ts@@ -6,6 +6,10 @@ const LAST_VISIBLE_CHARS = 6;// Map of route pattern -> response body fields that should be masked before logging.export const SENSITIVE_RESPONSE_FIELDS_BY_ROUTE = {"/tokens/embed/referrals": ["publicToken"],+ "/tokens": ["token"],+ "/oauth/apps": ["clientSecret"],+ "/webhooks": ["secret"],+ "/webhooks/:webhookId": ["secret"],} as const;// Stripe-style partial mask: visible prefix through the last `_` (e.g. `sk_live_`),