Secrets and Configuration Security for the Web

Secrets and Configuration Security for the Web

A leaked key grants its access without an exploit — an avoidable enterprise breach. A CTO read on where secrets leak, rotation, and inventory-before-policy.

A leaked key grants whatever access it carries, without an exploit, and legacy enterprise sites are exposed to this because secrets accumulate in client bundles, repositories, and config that no one rotates. This is a posture failure, not a sophisticated attack, which is exactly why it is the avoidable breach. This is the CTO read: where secrets actually leak, why rotation must be routine rather than incident-only, the least-exposure principle that keeps nothing in the client it does not need, and the inventory-before-policy mandate that has to come first.

Why leaked secrets are the avoidable breach

Much breach discussion assumes an attacker breaking something. A leaked secret skips that entirely. A valid key is, by design, the thing that grants access — an attacker who finds one is not exploiting a weakness, they are using the system exactly as it was built to be used, with a credential it was built to honor. There is no clever step to detect because there was no clever step.

That is what makes it the avoidable breach, and also a common one on a site that has not been rebuilt in three years. An untouched site does not leak one secret deliberately; it accumulates them. A key gets embedded in a client bundle to ship a feature fast and is never removed. A credential is committed to a repository during a migration and stays in the history after it is deleted from the head. A config value with real access lives in a file that everyone copies and nobody rotates. None of this fails in normal operation — the feature works, the deploy succeeds, the dashboard stays green — which is precisely why it is still there years later. The cost is not paid until the secret is found, and finding committed and bundled secrets can be automated and run continuously.

The time dimension is what makes this worse than it first reads. A committed secret does not become safe with age — it becomes a latent breach for as long as it stays valid, sitting in history and in every clone, waiting for an automated scan that can run continuously rather than once. The dwell time between leak and use is therefore not bounded by an attacker's effort, because there is no effort: it is bounded only by how long the secret stays valid, which, for a secret that is never rotated and has no expiry, has no end. A secret leaked three years ago, never rotated and never set to expire, is not a historical mistake that has aged out of relevance; it is a door that has been standing open for three years, and age has made it more exposed, not less.

The framing the CTO needs is that this is a posture problem with a posture answer, not an incident waiting for an incident response. The OWASP Top 10 (the 2025 edition, the most current released version as of Oct 2026) ranks security misconfiguration second (A02:2025) and lists default accounts and their passwords that are still enabled and unchanged as a condition under which an application might be vulnerable to it. It maps the weaknesses for hard-coded and default credentials to its authentication-failures category (A07:2025). The placement is telling: the breaches in this class do not require attacker sophistication, they require defender inattention, and inattention is exactly what a frozen, "stable" site institutionalizes.

Where secrets actually leak

A policy written before knowing where the secrets are is a policy aimed at the wrong place. The first move is to see the leak surface honestly, because a common leak location is also one often left out of the threat model.

Leak locationThe riskThe control
Client bundleAnything shipped to the browser is readable by anyone — a secret here is already publicNothing secret in the client; only public, scoped, rotatable values
Repository historyA secret deleted from the head still lives in history and in every clonePre-commit and history scanning; treat any committed secret as compromised
Logs and error outputSecrets printed into logs or stack traces leak to wherever logs goRedaction at the boundary; never log credential material
Config and environment filesFiles copied across environments carry real access with no rotationA managed store, not a copied file; access scoped per environment

The client bundle is the row to dwell on, because it is both common and often overlooked. The reasoning that puts a secret there is usually "the client needs to call this service, so the key has to be in the client." That reasoning is the vulnerability. Anything delivered to the browser is delivered to everyone, including the attacker — a secret in a client bundle is not weakly protected, it is published, and minification or obfuscation changes nothing about that. A site that has shipped any version of "the API key is in the front-end build" has a public credential whether or not anyone has noticed yet.

Build and deploy is the second underweighted surface. An audit that stops at source control misses that a secret can leak in the pipeline that assembles and ships the artifact as well as in the source it was assembled from — the deep mechanics of how a pipeline injects and protects secrets are covered by a separate article on this topic, and referenced here only so the leak surface is not drawn as if it ends at the repository. The point at posture altitude is that the surface is wider than source control alone.

Rotation and least exposure

Two principles convert this from a list of places to a posture, and both are decisions the CTO mandates rather than mechanics engineering chooses.

The first is rotation as routine, not incident-only. On legacy sites, rotation is something that happens after a leak, which means it is something the architecture was usually not built to do at all — and a key that cannot be rotated without a coordinated outage is not a credential, it is a liability with a long fuse. The posture is that every application secret — keys, tokens, service credentials — has a known rotation cadence exercised on schedule, before there is an incident, precisely so that the answer to "rotate everything now" is a routine operation rather than an emergency the system cannot perform. A secret that has never been rotated is not safe because nothing has gone wrong; it is untested, and the day it must rotate is the worst day to discover it cannot.

The second is least exposure: nothing in the client that the client does not need, and nothing granted broader access than the task requires. A leaked secret does more damage when it can do far more than the thing it was leaked for — a broadly-scoped key in a place it should never have been is two failures, not one. Least exposure caps the blast radius of the failure that will eventually happen, which is the realistic goal, because the honest posture assumes a leak will occur and decides in advance how much it is allowed to cost. Detection sits alongside both: scanning for leaked secrets, in code and in shipped artifacts, is a standing control and not a one-time sweep, because the surface regenerates every time a feature ships. The reference posture for handling and storing key material is the OWASP Secrets Management Cheat Sheet, with OWASP Cryptographic Storage for how the key itself is held — the audit names the gap, and those cheat sheets offer implementation guidance for closing it.

What a CTO mandates

The mandate at this altitude is small, specific, and ordered, and the order matters.

Inventory comes before policy. A policy issued without an inventory of every secret and where it lives is a policy enforced against the secrets you remembered, while the breach comes from the one you forgot — and the forgotten ones are likely to include legacy ones, embedded years ago by people no longer on the team. The first deliverable is not a rule; it is a list: every secret, its location, its scope, and whether it can rotate. That list is what converts "we should improve secrets handling" into a fundable plan with an owner per line, the same way a posture audit converts a vague intention into a tier and an owner.

Inventory is hardest precisely on the sites that need it most, and the reason is organizational rather than technical. A legacy site's oldest secrets were embedded by people who have since changed teams or left, in decisions that were never documented because nothing required documenting them at the time. The institutional memory of where access lives degrades faster than the access itself expires, which means the gap is widest exactly where the consequences are largest. That is why the inventory, not the policy, is the load-bearing artifact: a policy is a statement of intent the team can write in an afternoon, while the inventory is the discovery work that determines whether the policy applies to anything that actually exists.

From the inventory, two things become non-negotiable rather than aspirational: a managed store as the single place secrets live, replacing copied config files, and a rotation cadence that is exercised, not merely documented. Everything below that — the specific store, the injection mechanics, the scanning tooling — is handed to engineering on purpose, because that depth changes faster than the decision does and the audience for this read is allocating risk and budget, not selecting a tool. The durable posture is the one stated plainly: an enterprise site can be breached without any clever exploit, through a key it published or committed and never rotated, and that breach is avoidable by a posture decision made before the leak, not an incident response performed after it.

Project Inquiry