Knowledgebase

Configuration and Secrets Management Print

  • backenddevelopment, backend, hacked, caching, guide, howto, solution, zillionkinghost
  • 0

Keeping settings out of code.

WHAT BELONGS OUTSIDE THE CODE

Credentials API keys Endpoints differing by environment Feature flags Anything differing between development and production

WHERE TO PUT IT

Environment variables, or a secrets service.

WHAT TO COMMIT

An example file listing every required value, without values.

WHAT NEVER TO COMMIT

Actual secrets.

WHAT TO DO IF ONE WAS COMMITTED

Rotate it, assuming compromise.

WHY

It remains in the history, and history is frequently public or widely accessible.

WHAT TO DO AT STARTUP

Validate that every required value is present, and fail immediately with a clear message if not.

WHY

Failing at startup is better than failing obscurely under load.

WHAT TO BE CAREFUL WITH

Secrets appearing in logs Secrets passed as command arguments, visible in process lists Configuration cached and not reloaded

WHAT TO ROTATE

Credentials, periodically and on any staff departure.

WHAT TO RESTRICT

Who can read production configuration.

WHAT TO RECORD

Where each secret lives and who owns it.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot