Skip to content

Commit 71c1176

Browse files
waleedlatif1claude
andcommitted
fix(stripe): use configured secret key for SDK init
Avoids leaving a recognisable placeholder string in heap dumps and error serialisations. Webhook verification remains a purely local HMAC operation; the SDK's constructor key is unused by it. Addresses Greptile feedback on #4481. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 56d6a45 commit 71c1176

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/sim/lib/webhooks/providers/stripe.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createLogger } from '@sim/logger'
22
import { NextResponse } from 'next/server'
33
import Stripe from 'stripe'
4+
import { env } from '@/lib/core/config/env'
45
import type {
56
AuthContext,
67
EventFilterContext,
@@ -14,9 +15,11 @@ const logger = createLogger('WebhookProvider:Stripe')
1415

1516
/**
1617
* Stripe SDK instance used solely for `webhooks.constructEvent`. The API key is
17-
* irrelevant for signature verification, but the constructor requires a value.
18+
* not used by signature verification (purely local HMAC), but the SDK constructor
19+
* requires a value — pass the configured secret key when present to avoid leaving
20+
* a recognisable placeholder in heap dumps or error serialisations.
1821
*/
19-
const stripeClient = new Stripe('sk_webhook_verification_only', {
22+
const stripeClient = new Stripe(env.STRIPE_SECRET_KEY || '', {
2023
apiVersion: '2025-08-27.basil',
2124
})
2225

0 commit comments

Comments
 (0)