Operations

Configuration

Foundational

Configuration is the join between identical code and a specific running environment. Get it right and one build runs safely everywhere. Get it wrong and you ship a dev convenience to production or leak a secret into a config file. Keep config external, validated, environment-specific, and free of secrets.

The main idea (from the twelve-factor approach) is to separate config from code. The same artifact is promoted from dev to test to prod, and only the configuration differs. Configuration covers connection targets, feature flags, limits, and toggles. It does not cover secrets, which belong in the vault (see Secrets Management). Configuration bugs and security holes start when you mix the two, or bake environment assumptions into the build.

Configuration is also a safety surface. The Finperiti findings, RequireHttpsMetadata=false and wide-open CORS reaching production, were configuration mistakes. A setting that is fine in local dev escaped into a deployed environment. Validate config at startup. Make dev-only relaxations impossible to reach in prod. Fail fast when something required is missing.

Externalise and validate

Change config safely

Dev relaxation reaches prod options.RequireHttpsMetadata = false; // "needed for local testing"
// shipped as-is; now false in production too

A setting that is reasonable on localhost disables a security check everywhere it is deployed. The build carried a dev convenience into production because the config was not environment-specific.

Secure default, scoped relaxation options.RequireHttpsMetadata = true; // default everywhere
#if DEBUG
if (env.IsDevelopment()) options.RequireHttpsMetadata = false; // local only
#endif

Production always enforces the check. The relaxation exists only in a local development build and cannot be reached in a deployed environment.

Self-review checklist

Why it matters: Configuration is where the same trusted code becomes a specific, fallible deployment. A single wrong value can disable a security control, point at the wrong database, or leak a secret. Externalised, validated, secret-free configuration keeps environments consistent and stops dev conveniences from becoming production vulnerabilities.