no-apparmor-unconfined
disallow disabling AppArmor confinement via a devcontainer.json’s or Feature’s “securityOpt” property, or a “–security-opt apparmor=unconfined” entry in a devcontainer.json’s “runArgs”
Why
A container runtime applies its own AppArmor profile (“docker-default” for Docker) to every container on a host that has AppArmor enabled, restricting what the container may do to the host’s filesystem, capabilities, and network. “apparmor=unconfined” removes that profile outright, so the only thing left between a process in the container and the host is the discretionary access control the container’s user is already subject to. The setting is usually copied from instructions for running nested containers or a debugger, both of which have narrower settings that work.
Bad
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"securityOpt": ["apparmor=unconfined"]
}
Good
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"capAdd": ["SYS_PTRACE"]
}