Skip to content

MappedDirectory enforcement and misc fixes#2727

Draft
MahatiC wants to merge 2 commits intomicrosoft:mainfrom
MahatiC:enforce-readonly-mount
Draft

MappedDirectory enforcement and misc fixes#2727
MahatiC wants to merge 2 commits intomicrosoft:mainfrom
MahatiC:enforce-readonly-mount

Conversation

@MahatiC
Copy link
Copy Markdown
Member

@MahatiC MahatiC commented May 7, 2026

Commit 1: CWCOW: Filter environment variable

The GCS sidecar was evaluating security policy for environment variables but discarding the filtered result. This meant policy could block containers with disallowed env vars, but couldn't selectively strip individual variables. This commit captures the filtered env list and rewrites the request with it before forwarding to GCS.

Commit 2: CWCOW: Enforce MappedDirectory inside gcs-sidecar

The GCS sidecar had no enforcement for ResourceTypeMappedDirectory (VSMB shares) or path validation for ResourceTypeMappedVirtualDisk/ResourceTypeMappedVirtualDiskForContainerScratch (SCSI mounts). This would allow an untrusted host to share arbitrary directories into the UVM without policy checks. This commit adds:

  • EnforceMappedDirectoryMountPolicy -- validates the
    read-only invariant inside the UVM and prevents duplicate mounts at the same container path. Path pattern validation ensures SCSI mounts only target c:\mounts\scsi\m
  • Path pattern validation for SCSI mounts -- ensures ContainerPath matches c:\mounts\scsi\m
  • New mapped_directory_mount / mapped_directory_unmount Rego enforcement points with error reporting

MahatiC added 2 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>
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.

1 participant