# Replit app security before launch

> 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.

Canonical: https://shipfast.online/rescue/replit/security/
Last updated: 2026-10-25

By [Prayag Dalal](https://shipfast.online/about/). Checked against Replit's documentation on 2026-10-25.

## Symptoms

- The security scan reports vulnerabilities, or publishing is blocked by critical ones.
- An API key or database connection string ended up in the code or in a chat.
- Customers see a Replit-branded sign-in page, and you’re not sure that’s right for a commercial app.

## Why it happens

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.

## 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

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.

## FAQ

### 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.

## Sources

- [Replit docs: Publishing](https://docs.replit.com/features/publishing/overview)
- [Replit docs: Secrets](https://docs.replit.com/replit-workspace/workspace-features/secrets)
- [Replit docs: Database connection details](https://docs.replit.com/features/data-and-storage/connection-details)
- [Replit docs: Auth](https://docs.replit.com/learn/projects-and-artifacts/auth)
- [Replit docs: Troubleshoot publishing](https://docs.replit.com/build/troubleshooting)

## Get it fixed

App rescue, From $1,000, fixed price: [send your app](https://shipfast.online/contact/?service=app-rescue).

## Related

- [All Replit guides](https://shipfast.online/rescue/)
- [Free production readiness check](https://shipfast.online/tools/production-readiness-check/)
