Opt-in privileged shells via AWS additionalOsCapabilities - #4
Merged
Conversation
Add support for AWS Lambda MicroVM "Operating system capabilities": build
and launch throwaway shells that can mount filesystems, create network
namespaces, run eBPF, and nest containers — operations a root shell cannot
perform under the default restricted capability set.
Capabilities are modelled in the library as a forward-compatible
[]Capability (only CapabilityAll = "ALL" is accepted today) and threaded
through ImageSpec/BuildFromSourceOptions -> awsapi -> the SDK. The CLI
exposes a truthful boolean:
- `whim build --privileged` bake ALL caps into a custom image
- `whim --privileged` / `whim run --privileged`
launch the well-known whim-privileged image (tooling: util-linux,
iproute, e2fsprogs), auto-built on first use like `whim init`,
mutually exclusive with --image
Capabilities are part of the image reuse contract: reuseImage compares an
existing version's additionalOsCapabilities (via a new GetMicrovmImageVersion)
against the request and refuses a mismatch (ErrCapabilityMismatch), so a
privileged build never reuses an unprivileged image or vice versa, and
`whim --privileged` verifies a cached ARN is actually privileged before reuse.
Hardening and correctness:
- validateImageSpec (required fields + caps + egress) runs before any
destructive/AWS action, so an invalid or incomplete spec never costs the
caller their image on ForceRebuildImage's delete.
- privileged auto-build is bounded by imageBuildTimeout and streams progress
to stderr, keeping `whim run` stdout limited to remote output.
- `whim image rm` now prunes the deleted image's config entry.
Validated live: an ["ALL"] image reaches CREATED/ACTIVE, a privileged shell
performs mount/netns/unshare while an identical unprivileged shell is denied,
and a non-privileged build over the privileged image is refused.
Address errcheck (unchecked Close in read-only source paths) and staticcheck QF1001 (De Morgan simplifications) in the microvm source loaders. Bump checkout@v5, setup-go@v6, and golangci-lint-action@v8 to drop the deprecated Node 20 action runtime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds support for AWS Lambda MicroVM Operating system capabilities — throwaway shells that can mount filesystems, create network namespaces, run eBPF, and nest containers, none of which a root shell can do under the default restricted capability set.
Privilege is opt-in: default images stay minimal-cap and it is never granted implicitly.
How
Correctness & hardening
Validation
Out of scope (documented)
Baked/snapshotted Docker daemon, per-capability granularity (AWS supports only ALL), and auto-upsizing disk/memory for nested workloads.