- Home
- The 30 checks
- Your login secret has a fallback written in the code
Your login secret has a fallback written in the code
In plain English: The secret that signs your login tokens or session cookies has a backup value written in the code, like process.env.JWT_SECRET || "dev-secret". If the real setting is ever missing, your app quietly uses the value anyone can read in the code, and then anyone can make a valid login for any account.
What happens if you ship it
If the variable is missing where the app runs, the value written in the code is used instead, and anyone who reads the code can sign a login token or session cookie for any account.
How to fix it technical
Let your AI tool fix it
Paste this into Lovable, Bolt, Cursor, Replit or Claude Code:
Fix this problem in my project: Your login secret has a fallback written in the code. Remove the fallback. Read the secret only from the environment, and stop the server at start-up when it is missing. Change only what this fix needs, then tell me what you changed and anything I have to do myself.Check your app
Run npx sigship in your project folder. It reports this problem as signing-secret-fallback, along with 29 other checks. Nothing leaves your computer. New to the terminal?
Questions
What is a signing secret?
A private value your server uses to stamp login tokens and cookies, so it can tell real ones from fakes. Whoever knows it can make tokens your server accepts.
Why not keep a default for local development?
Because the same code runs in production. Put the development value in your local .env file instead, and make the server stop at start-up when the secret is missing.
Does this apply to Flask and Django too?
Yes. A literal app.secret_key, or a SECRET_KEY with a default in os.environ.get, is the same problem.