3 security fixes before you submit your app
Three things that can get your app rejected, or worse, get you sued. Each one has a copy-paste prompt you can run against your codebase before you submit. These...
the short answer
This post outlines three critical security fixes to apply before submitting an app to avoid rejection or legal trouble: removing exposed secrets from git history, preventing field tampering via strict allowlist validation, and encrypting sensitive data at rest.
key takeaways
- Scan and rewrite git history using BFG Repo-Cleaner or git filter-repo to remove any exposed API keys, tokens, passwords, or connection strings, then rotate all exposed credentials immediately.
- Implement strict allowlist validation on every endpoint that accepts user input to reject any field not explicitly expected, including privilege fields like role, isAdmin, and permissions that users should not be able to set.
- Hash all passwords with bcrypt or argon2 and encrypt other sensitive fields at rest so they remain unreadable even if someone gains direct database access.
- Store encryption keys outside the codebase and never hardcode them, as hardcoded keys defeat the purpose of encryption.
- Add a .gitignore file and pre-commit hooks to block secrets from ever being committed to the repository again.
Three things that can get your app rejected, or worse, get you sued. Each one has a copy-paste prompt you can run against your codebase before you submit.
These are the same security gaps that landed developers in legal trouble, as covered in How to Not Get Sued 101.
01 / purge your git secrets
If you ever pasted an API key into your code and pushed it, it's still sitting in your Git history, even if you deleted it in a later commit. Anyone with repo access can dig it out. Deleting the line going forward doesn't fix it. You have to scrub the history and rotate the key.
Scan my entire Git history for anything that looks like a secret: API keys, tokens, passwords, connection strings, private keys.
1. List every file and commit where a secret appears, even if it was later deleted or overwritten.
2. For each one, tell me whether it's still reachable in the current history (it is, unless the history itself was rewritten).
3. Walk me through rewriting Git history to remove them (BFG Repo-Cleaner or git filter-repo), including the force-push and re-clone steps for anyone else on the repo.
4. Give me a checklist of exactly which exposed keys I need to rotate right now, in priority order.
5. Add a .gitignore and a pre-commit hook that blocks secrets from ever being committed again.
02 / block field tampering
If your signup form sends a JSON object straight to your database, someone can add a field that was never on your form, like "role: admin," and your server might just accept it. The fix is to only allow the exact fields you expect and reject everything else.
Go through every endpoint that writes to my database from user input (signup, profile update, checkout, anything with a form or API body).
1. For each one, show me the exact fields it currently accepts.
2. Add strict schema validation (allowlist, not blocklist) so any field not explicitly expected is rejected, not silently dropped or accepted.
3. Specifically check for privilege fields like role, isAdmin, permissions, or userId being settable from the client, and lock those down so only the server can set them.
4. Show me the before and after for one endpoint so I can see exactly what changed.
5. Confirm this validation runs on the server, not just in the frontend form.
03 / encrypt sensitive data
This is the one that actually gets you sued. If you're storing passwords, IDs, or health info as plain text and your database ever leaks, that data is instantly readable by whoever gets their hands on it. That's a data breach. The fix is to encrypt sensitive fields at rest, not just lock them behind a login.
Audit my database schema and tell me every field that stores sensitive data: passwords, government IDs, health info, financial info, or anything else that would be a problem if it leaked.
1. Confirm passwords are hashed with bcrypt or argon2, never encrypted or stored as plain text.
2. For all other sensitive fields, add encryption at rest so the raw value is unreadable even if someone gets direct access to the database.
3. Show me where the encryption keys are stored, and confirm they're not hardcoded or committed to the repo.
4. Point out any place these fields get logged, cached, or sent to third-party tools in plain text, since that defeats the encryption.
5. Give me a one-paragraph summary I could show a lawyer or investor proving this data is protected at rest.
Note: run these one at a time, not all in one prompt. Let your AI finish and show you the diff before moving to the next one, so you actually see what changed.
That's the difference between shipping fast and shipping fast and safe.
frequently asked
How do I remove API keys from git history?[+]
Use BFG Repo-Cleaner or git filter-repo to rewrite your git history and remove all instances of secrets, then force-push the changes and have all collaborators re-clone the repository. Simply deleting the line in a later commit does not remove it from history.
How do I prevent field tampering in my app?[+]
Implement strict allowlist validation on every endpoint that accepts user input. Only allow the exact fields you expect and reject everything else. Specifically block users from setting privilege fields like role, isAdmin, or permissions from the client side.
What sensitive data should I encrypt in my database?[+]
Encrypt any data that would cause problems if leaked, including passwords (hashed with bcrypt or argon2), government IDs, health information, financial info, and connection strings. Plain text storage of this data constitutes a data breach if your database is compromised.
How do I stop users from adding admin roles to forms?[+]
Use server-side allowlist validation that explicitly rejects any field not on your approved list. Check for privilege fields like role, isAdmin, permissions, or userId being submitted from the client and lock those down so only the server can set them.
What security fixes prevent app rejection or legal issues?[+]
The three critical fixes are: purging git secrets from history and rotating exposed keys, blocking field tampering through strict allowlist validation, and encrypting sensitive data at rest. Running these checks before submission prevents rejection and potential lawsuits from data breaches.
keep exploring