Skip to content

Commit 352b55c

Browse files
committed
Add ignore-imex-channel-requests feature flag
This allows the NVIDIA Container Toolkit to ignore IMEX channel requests through the NVIDIA_IMEX_CHANNELS envvar or volume mounts and ensures that the NVIDIA Container Toolkit cannot be used to provide out-of-band access to an IMEX channel by simply specifying an environment variable, possibly bypassing other checks by an orchestration system such as kubernetes. Signed-off-by: Evan Lezar <[email protected]>
1 parent 65b575f commit 352b55c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

cmd/nvidia-container-runtime-hook/container_config.go

+4
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ func getMigDevices(image image.CUDA, envvar string) *string {
198198
}
199199

200200
func (hookConfig *hookConfig) getImexChannels(image image.CUDA, privileged bool) []string {
201+
if hookConfig.Features.IgnoreImexChannelRequests.IsEnabled() {
202+
return nil
203+
}
204+
201205
// If enabled, try and get the device list from volume mounts first
202206
if hookConfig.AcceptDeviceListAsVolumeMounts {
203207
devices := image.ImexChannelsFromMounts()

internal/config/features.go

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ type features struct {
2828
// DisableImexChannelCreation ensures that the implicit creation of
2929
// requested IMEX channels is skipped when invoking the nvidia-container-cli.
3030
DisableImexChannelCreation *feature `toml:"disable-imex-channel-creation,omitempty"`
31+
// IgnoreImexChannelRequests configures the NVIDIA Container Toolkit to
32+
// ignore IMEX channel requests through the NVIDIA_IMEX_CHANNELS envvar or
33+
// volume mounts.
34+
// This ensures that the NVIDIA Container Toolkit cannot be used to provide
35+
// access to an IMEX channel by simply specifying an environment variable,
36+
// possibly bypassing other checks by an orchestration system such as
37+
// kubernetes.
38+
IgnoreImexChannelRequests *feature `toml:"ignore-imex-channel-requests,omitempty"`
3139
}
3240

3341
type feature bool

0 commit comments

Comments
 (0)