Secure by Default
Secure by DefaultWhat Is Secure by Default?
Secure by default is a design principle in which a system's out-of-the-box configuration is its safe configuration, so a user who changes nothing is already protected. Security becomes the starting state rather than something achieved through hardening steps performed afterwards. The burden of getting it right moves from every consumer to the party that built the thing.
The principle exists because defaults determine outcomes at scale. Documentation that explains how to configure something safely will be followed by a minority of users. A default that is already safe protects everyone, including the people who never read the documentation.
Applied to container images, it means an image arrives without unnecessary packages, without a shell it does not need, running as a non-root user, with no default credentials and with current patches already applied.
How Secure by Default Is Built Into Container Images
Turning the principle into an artifact involves a consistent set of build decisions.
- Minimal content. Only the packages required at runtime are included, so compilers, shells and package managers are absent from the runtime image.
- Non-root execution. The image declares an unprivileged user rather than relying on the deployment to override root.
- No embedded secrets or default credentials, so nothing ships with a known password.
- Current patches at build time, with rebuilds published when upstream fixes land rather than on a fixed calendar.
The second decision is often the most consequential in practice, because a container running as root is a far shorter path to a serious incident than an unpatched package in an unused library. Most deployment guidance assumes the opposite.
The build process matters as much as the content. Images built from source let the provider apply fixes directly, rather than layering patches on top of a base someone else assembled.
What Secure by Default Does Not Give You
A safe starting state is a floor, not a ceiling, and it stops at the boundary of the artifact.
An image cannot protect you from how it is deployed. Mounting a privileged socket, granting a permissive security context or passing credentials through environment variables undoes the work regardless of how the image was built. Nor does the principle cover your own application code and its dependencies, which are added on top.
Keep the boundary clear.
- It covers the artifact, not the orchestration or the network around it.
- It does not cover your application layer, which arrives after the base image.
- It decays without rebuilds, since defaults that were current at build time age with the vulnerability database.
- It can be overridden, and frequently is, by deployment configuration.
The practical implication is that admission policy and runtime controls remain necessary even with a strong starting artifact.
How to Apply Secure by Default in Production Environments
The principle generalizes beyond images, and the implementation is mostly about where you place enforcement.
- Standardize on base images that start minimal, rather than shipping a full distribution and removing packages afterwards.
- Enforce non-root and read-only filesystems at admission, so a permissive manifest cannot reach the cluster.
- Make the safe path the easy path, with templates and golden configurations that teams copy rather than compose.
- Rebuild on a schedule, because safe defaults are a point-in-time property that expires.
- Audit overrides, since the interesting risk is in the deliberate exceptions rather than in the defaults.
The last one is where most incidents originate, and it is the step most often missing.
How Hardened Container Images Deliver Safe Defaults
Hardened container images are a direct expression of this principle: the provider makes the restrictive choices at build time so that every consumer inherits them.
That shifts work from thousands of individual deployment decisions to one build decision, which is the only version of this that scales across an organization. What a buyer should check is which of those decisions the provider documents.
What it does not do is replace deployment controls or your own application security. Echo sets out the broader argument in its explanation of why hardened images matter.
FAQs
Is a minimal image automatically a safe one?
No. Minimal content reduces attack surface and scanner findings, which is genuinely valuable, but an image can be small and still run as root, ship a stale package set or carry an embedded credential. Size is one property among several, and the others are easier to get wrong because they are less visible.
Does running as non-root break applications?
Sometimes, usually where an application binds a privileged port, writes to a path owned by root, or expects to install packages at startup. All three have standard remedies: bind a high port and map it, write to a designated writable path, and install at build time instead. The work is modest and done once per image.
How does this relate to hardening benchmarks?
Benchmarks such as CIS and STIG describe a target state and a set of checks to verify it. The design principle here describes where that state should come from. An image that arrives in a compliant state means the benchmark becomes a verification step rather than a remediation project, which is considerably cheaper to operate.
Can safe defaults be overridden?
Yes, and deployment configuration overrides them routinely. A security context granting privileged execution, a mounted host path or an injected credential can undo the artifact's properties entirely. This is why admission control matters: the artifact sets the floor, and policy enforcement at deploy time is what keeps teams on it.
Do safe defaults expire?
In effect, yes. An image built with current patches is current only at the moment it was built, and the vulnerability database keeps moving. Without a rebuild cadence the same artifact accumulates findings while appearing unchanged, which is why rebuild frequency belongs in any provider evaluation. Ask how often images are rebuilt, not only how they are built.







