Stripe secret key in client code: what to do
A Stripe secret key belongs on your server; a publishable key is designed for the browser. If a real secret reached client code, rotate it, review account activity and move privileged operations behind a validated server boundary.
Check your app free, first fix freeClassify the exposed value before changing checkout. A publishable key is expected in browser code, while secret and restricted keys carry server authority. Rotate a leaked private credential, verify server-side prices and fulfillment, and test the repaired flow without live charges. A public scan cannot prove that payment capture or webhook handling is correct.
Distinguish the key types first
Stripe's publishable keys are intended for client integrations. Secret keys and restricted server keys are not interchangeable with them. A test-mode secret is still a secret for its environment, even though it does not represent the same immediate live-payment authority as a live credential.
Do not replace a publishable key with a secret because a frontend integration says a value is invalid. Confirm that the key belongs to the intended account and mode. Mixing test and live configuration can produce errors that no amount of exposing additional authority will safely solve.
Rotate privately and inspect the affected account
Use Stripe's documented key-management process to roll or revoke the exposed secret. Review API requests and relevant account activity for unexpected operations. Keep complete credentials out of screenshots, public tickets and scanner evidence.
Check every legitimate server consumer when replacing the credential. A checkout route, webhook-related lookup and background fulfillment path may rely on different configuration. Do not make real purchases merely to confirm that an environment variable is present; use the provider's supported test environment.
Rebuild the checkout trust boundary
The browser may select a product, but it must not supply the trusted amount or declare its own payment status. Resolve prices on the server and verify the provider's result before granting paid access.
Browser: request checkout for an allowed product identifier
Server: resolve the trusted product and amount
Provider: perform the payment in the intended mode
Server: verify payment identity, amount and final state
Server: fulfill the purchase idempotently
Browser: display the server's confirmed access stateThis is a review sequence, not a complete payment implementation. In particular, cancellation, pending outcomes and repeated notifications must not cause a false paid state or duplicate fulfillment. Verify webhook signatures using the provider's documented mechanism rather than trusting a JSON body that merely says success.
Find the client exposure mechanism
Review public environment variables, client imports, page props and debug endpoints. Renaming a variable is insufficient if the code still returns it to the browser. Search the built assets and inspect the production network response after deployment.
If old assets remain public, revocation contains their authority. Cleaning caches and previous deployments can reduce future distribution, but it is not a substitute for rotating the credential. Also review repository history under your team's coordinated process.
Keep the product's own checkout distinct
This is a guide for applications that integrate Stripe. It is not a claim that ProofForge's current one-time checkout uses Stripe. Evaluate each application's real payment provider and do not apply a different provider's response formats or webhook rules to it.
Turn the check into a release decision
Keep a small record of the production URL, the time you checked it, the exact finding and the action you took. A local preview and a deployed application can have different environment variables, response headers and database projects. After a repair, deploy the intended version and check the public address again. Do not assume that changing a repository file changed the live system.
Read coverage as carefully as the score. A timed-out asset, an ambiguous backend configuration or a request that could not safely establish access should remain unknown. It should not disappear from your release notes merely because there is no red finding. If a check was not completed, decide who will review it and what additional evidence is needed.
ProofForge's free report includes the first fix. The $9 Fix Report unlocks all findings' available repair guidance and builder prompts, with a PDF and private report link. Fix + Guard costs $29 once and adds builder rules, on-demand deploy-hook scans for 30 days and four weekly rechecks you start yourself. These are different deliverables, not different promises that an application is completely secure.
Keep private report URLs out of public issues and commits. If you need shareable evidence, use the owner-verification and publication flow for an eligible receipt. A signature protects the recorded assessment against undetected changes; it does not make the assessment exhaustive, prove a business outcome, or show that a later deployment still matches an earlier result.
Questions builders ask
Should a Stripe publishable key be hidden?
Can the browser tell my server a payment succeeded?
Will a scan test real charges or refunds?
Related checks and fixes
Continue with a related guide
Sources
Scan your app free
See what your live app ships to every visitor, with the first fix free. A clean scan is not a full audit. Run it only on an app you own or have permission to test.
Scan your app free