Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit 4cf084d

Browse files
authored
Merge pull request #812 from Random-Liu/cherrypick-#808
Erase ambient capabilities.
2 parents 8845f14 + 73d3ea1 commit 4cf084d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/server/container_create.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,11 @@ func (c *criService) generateContainerSpec(id string, sandboxID string, sandboxP
372372
securityContext.GetCapabilities())
373373
}
374374
}
375+
// Clear all ambient capabilities. The implication of non-root + caps
376+
// is not clearly defined in Kubernetes.
377+
// See https://github.com/kubernetes/kubernetes/issues/56374
378+
// Keep docker's behavior for now.
379+
g.Spec().Process.Capabilities.Ambient = []string{}
375380

376381
g.SetProcessSelinuxLabel(processLabel)
377382
g.SetLinuxMountLabel(mountLabel)

pkg/server/container_create_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ func TestContainerCapabilities(t *testing.T) {
261261
assert.NotContains(t, spec.Process.Capabilities.Inheritable, exclude)
262262
assert.NotContains(t, spec.Process.Capabilities.Permitted, exclude)
263263
}
264+
assert.Empty(t, spec.Process.Capabilities.Ambient)
264265
}
265266
}
266267

0 commit comments

Comments
 (0)