The short answer

Replit scans for vulnerabilities before every publish; turn on blocking for critical findings. Keep keys in Secrets, check the published app’s secrets yourself because Replit’s docs disagree on whether they carry over, regenerate any leaked database credentials, and check access in every route.

Why it happens

What’s actually going on

Replit always runs a security scan before publishing, and a setting can block publishing when critical vulnerabilities are found. Security Agent combines AI with static analysis tools. But scanners read your code; they don’t know your business rules.

Most real risk sits in how secrets are handled (keys belong in Secrets, not code), the production database credentials, and access checks in your own backend routes.

Already done for you

What Replit already handles

Pre-publish security scan

Runs before every publish, and can block publishing when it finds critical vulnerabilities.

Secrets

Encrypted values your app reads as environment variables. Not available on Static Deployments.

Scoped database credentials

The development DATABASE_URL works only for your app, and production credentials can be regenerated if they leak.

Database layer with validation

When Agent adds a database, it adds an ORM with schema validation and input sanitising against SQL injection.

Fix it yourself

Step by step

In this order. Most apps get most of the way with these alone.

  1. Run the scan and block critical issues

    In Publishing, run the security scan, fix critical findings, and turn on blocking for critical vulnerabilities.

  2. Move every key into Secrets

    Search the code for keys. Anything committed or pasted somewhere shared should be rotated with the provider.

  3. Check the published app’s secrets

    Replit’s docs disagree on whether editor secrets carry over to the published app, so open Publishing → Adjust settings and confirm production values, such as live keys, are there.

  4. Regenerate leaked database credentials

    If a production connection string was exposed, regenerate it in the Database tool. Old strings stop working immediately.

  5. Choose the right sign-in

    Replit Auth uses Replit accounts and a Replit-branded page. Clerk Auth gives your app its own accounts and branding, with separate development and production environments.

  6. Check access in your routes

    Every route that returns or changes user data should check the signed-in user, not just hide buttons in the interface.

Where it still goes wrong

  • A scanner can’t know that one customer shouldn’t see another’s invoice. Test with two accounts.
  • Regenerating credentials breaks any external tool still using the old connection string, so update them straight away.
  • Controlling who can open the published app is a Pro and Enterprise feature.

When to bring in a developer

If the steps above turn up more than you have time for, or the app already has paying users, I take Replit apps to production: login and access rules, database and backups, payments, security, SEO and deployment.

App rescue: From $1,000, fixed price, scoped in writing before any work starts.

More in app rescue, or hire a Replit developer.

Questions

Common questions

Does Replit scan my app for security issues?

Yes. It always runs a security scan before publishing, and you can block publishing when critical vulnerabilities are found.

Where should API keys go on Replit?

In Secrets, which are encrypted and exposed to your app as environment variables. Static Deployments don’t support Secrets.

Replit Auth or Clerk Auth?

Replit’s docs suggest Replit Auth for prototypes and internal tools, and Clerk Auth for branded, customer-facing or commercial products.

Someone saw my database URL. What now?

Regenerate the production database credentials in the Database tool. Existing connection strings stop working immediately, so update any tools that used them.

Want your Replit app production-ready?

Send me the app and what’s worrying you. You get a written scope with a fixed price before any work starts.

Book a 30-minute call