All jobs / Backend developer / Security
Backend developer interview question · 0–1 years
The interviewer asks: “Where do database passwords and API keys live?” Strongest answer?
The strongest answer
In the environment or a secret store injected at deploy — never in source, never in the image layer as a default committed to git.
Why it works
Exactly. Code is copied, forked and logged. Secrets are injected. Twelve-factor is still the interview answer in 2026.
What a good answer covers
- Secrets are injected, not committed.
- Environment or a secret manager.
- No production passwords in the repo.
- A leaked .env is an incident.
Answers that fall short
- Close, but not the strongest: A config file next to the code; I just don't check the production one in.
A gitignored file is easy to commit by accident and impossible to rotate from the platform. Prefer the environment or a vault. - Weak: Hardcode defaults and override them in an if (production) block.
Production branches in code rot, and a default in source is one deploy away from being real. - Red flag: Commit .env with the production database password so new hires can start on day one.
A password in git is in every clone, every CI log, every laptop. Rotate it as an incident, don't “fix it later.”
Who gets asked this
More Security questions
- The interviewer asks: “How do you put user input into SQL?” Strongest answer?
- The interviewer asks: “We set CORS to our frontend origin. Are we safe?” Strongest answer?
- The interviewer asks: “How do services get secrets in production?” Strongest answer?
- The interviewer asks: “What must never land in logs or traces?” Strongest answer?
- The interviewer asks: “A user asks us to delete their data. What does a backend actually do?” Strongest…
- The interviewer asks: “Threat-model this order service. Where do you start?” Strongest answer?
- The interviewer asks: “A customer requires their data stay in the EU. What do you actually implement?”…
- The interviewer asks: “The API pod's cloud role can read all buckets and impersonate other roles. What's…