Skip to content

Cwcow policy changes - #2842

Draft
takuro-sato wants to merge 54 commits into
microsoft:mainfrom
takuro-sato:cwcow-policy-changes
Draft

Cwcow policy changes#2842
takuro-sato wants to merge 54 commits into
microsoft:mainfrom
takuro-sato:cwcow-policy-changes

Conversation

@takuro-sato

Copy link
Copy Markdown
Contributor

Changes

Misc changes

MahatiC and others added 30 commits May 7, 2026 22:06
Capture and apply envToKeep from policy enforcement in createContainer,
external exec, and in-container exec. Previously the filtered env list
was discarded.

Add ociEnvToProcessParamEnv and rewriteExecRequest helpers with tests.

Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Add EnforceMappedDirectoryMountPolicy/UnmountPolicy to enforce VSMB
directory shares for confidential Windows containers. Writable mapped
directories are denied; duplicates at the same container path are
prevented. Also add path pattern validation for MappedVirtualDisk
and MappedVirtualDiskForContainerScratch to ensure SCSI mounts only
target c:\mounts\scsi\m<N>.

Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
This reverts commit 5c658a5.

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
…ess"

This reverts commit 8a9015b.

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
…licy

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
registry_changes now narrows data.metadata.matches to the container(s) that authorize the kept subset of requested values, mirroring the environment-variable dropping pattern, and returns that subset (registry_changes_to_keep) so the host-side enforcer applies only the sanctioned values. Because both registry_changes and create_container are filters over data.metadata.matches, the decision composes regardless of which runs first.

EnforceRegistryChangesPolicy now returns the policy-kept registry changes; the gcs-sidecar rebuilds the forwarded RegistryChanges as the pre-approved defaults plus the kept non-default values before forwarding to the inbox GCS.

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
…n modifysettings request

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
…work pass-through

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Reject host-supplied container IDs that aren't a containerd-style identifier (alphanumeric segments joined by single ./_/-) before recording or forwarding them, as defense-in-depth against the ID being joined into a filesystem path downstream.

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Track container termination from the guest container-exit notification and refuse a CWCOWCombinedLayers Remove whose root is still used by a running container (cf. LCOW Host.IsOverlayInUse).

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
…ed container)

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Watch the inbox GCS response for CWCOWCombinedLayers and
MappedDirectory mount/unmount requests. If the inbox reports a
failure, mark the UVM inconsistent so all further container
creation/deletion and mount/unmount are refused (cf. LCOW
setUVMInconsistent).

Why fail closed instead of reverting the policy state: the sidecar
forwards these operations to the inbox GCS rather than performing
them itself, so it cannot observe or cleanly undo their effects. A
real revert would need synchronous request/response correlation plus
careful undo of the staged rego metadata and sidecar caches. Failing
closed is simpler and safe: we never continue on policy state that
may be out of sync with what is actually mounted.

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
The container scratch disk is added via MappedVirtualDiskForContainerScratch
but removed as a plain MappedVirtualDisk; forward the Remove (a harmless
detach) so teardown completes, while still rejecting a raw Add. Restores the
mount -> unmount -> re-mount lifecycle for the same container root.

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants