containerd hosts.toml Registry Credentials Need Host and Path Scope Review
containerd hosts.toml Registry Credentials Need Host and Path Scope Review Registry configuration is part of the container supply chain even when it sits outside the application repository. containerd uses per-registry
containerd hosts.toml Registry Credentials Need Host and Path Scope Review
Registry configuration is part of the container supply chain even when it sits outside the application repository. containerd uses per-registry host namespaces and optional hosts.toml files to define mirrors, endpoints, TLS settings, and authentication behavior. A review that only checks whether an image pull succeeds can miss credentials attached to the wrong host, a mirror that receives more trust than intended, or a path rule that is broader than the repository it serves.
A host namespace is a security boundary
The containerd documentation defines a registry host namespace as a path derived from the registry host name or IP address, with an optional port. A hosts.toml file in that namespace configures the endpoints used for that host. The file is not a generic global proxy setting.
Treat each host namespace as a policy object. Record who owns it, which registry it represents, what mirror or upstream endpoints it can reach, and which credentials it may use. If the namespace directory is writable by a broader group than the registry configuration owner, an attacker may not need the production registry password to redirect pulls.
The documentation notes that updates under the registry configuration directory do not require restarting the containerd daemon. That convenience also means file permissions, configuration management, and change monitoring are active controls rather than background details.
Keep credentials narrow
Use a credential only for the registry endpoint and repository scope that requires it. A read token for one private project should not be installed in a host namespace that can serve every image on the node. Separate namespaces and endpoint rules when production and development registries require different trust.
Avoid embedding credentials in a world-readable file or a shared configuration directory. Confirm the ownership and mode of the directory tree, the hosts.toml file, and any referenced secret. If a deployment tool writes the file, confirm that its temporary files and backups have the same protection.
Mirrors deserve their own review. A mirror is not automatically identical to the upstream registry just because it returns an image with a familiar name. Decide whether client-side signature or digest verification is required and whether the mirror is authorized to serve that namespace.
Test resolution and fallback
For each critical image, determine which endpoint contains the content, which credentials are sent, and what happens when the first endpoint fails. A fallback chain can improve availability, but it can also move a pull to a less trusted endpoint. Test the failure path by disabling a mirror in a controlled environment and observing the selected registry and authentication behavior.
Do not infer the active configuration from the client's success alone. Capture the container runtime configuration, the host namespace path, the effective endpoint order, and the credential source. Correlate that evidence with registry access logs.
Verify the image after transport
TLS and registry authentication protect the channel and account identity. They do not prove that the image content is the version the workload policy expects. Compare the resolved digest, verify the image signature or provenance policy where the organization uses one, and record the result before deployment. Host configuration and content policy are separate gates.
During incident review, check for recently changed hosts.toml files, endpoint additions, credential changes, and unusual registry access. A successful pull is not enough evidence that the configured trust path was correct.
References
- containerd registry host configuration, containerd documentation. Retrieved 2026-11-18.
- containerd CRI registry configuration, containerd documentation. Retrieved 2026-11-18.
- containerd CRI configuration reference, containerd documentation. Retrieved 2026-11-18.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.