BT San Technology

12 January 2026

API keys and environment variables: keeping web app secrets out of the code

2 min read · Websites and web apps

Illustration: a laptop listing keys with masked values and toggles, beside a locked metal box and a USB key
AI-generated illustration

Ordinary configuration differs from secrets. A value sent to the browser cannot be treated as secret on the server side. Issue least-privilege access, rotate keys and revoke them.

Implementation steps

  1. Make an inventory of secrets and the owner of each
  2. Separate permissions and sets of secrets for each environment
  3. Check code paths, build files and logs that might expose a value
  4. Rehearse rotating and revoking, and confirm the service still works

Example deliverable

Deliverable: a secrets register that holds only the name, the owner and the review cycle

Benefits

Helps control access to services and respond when a key leaks.

Limits and cautions

An environment variable name does not make the value secure automatically. Check where the value gets bundled.

Starting references

  • OWASP — Secrets Management
  • The Twelve-Factor App — Config

References

  1. OWASP — Secrets Management (accessed 2026-11-21)
  2. The Twelve-Factor App — Config (accessed 2026-11-21)

Add us on LINE

Scan with the LINE app on your phone

QR code to add LINE @Bankoos

LINE ID: @Bankoos

Open LINE on this computer