From 18a01c0020c5d9bdb6d6d4850ffb37b74e6959ee Mon Sep 17 00:00:00 2001 From: Samuel Karp Date: Wed, 11 Feb 2026 16:39:39 -0800 Subject: [PATCH] ctr: add --scrub-logs flag for Windows Adds a new --scrub-logs flag to ctr run on Windows. This flag enables the ScrubLogs option for the io.containerd.runhcs.v1 shim. Assisted-by: gemini-cli Signed-off-by: Samuel Karp --- cmd/ctr/commands/run/run_windows.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/ctr/commands/run/run_windows.go b/cmd/ctr/commands/run/run_windows.go index 26620b49c2..b9828dcb3a 100644 --- a/cmd/ctr/commands/run/run_windows.go +++ b/cmd/ctr/commands/run/run_windows.go @@ -39,6 +39,10 @@ var platformRunFlags = []cli.Flag{ Name: "isolated", Usage: "Run the container with vm isolation", }, + &cli.BoolFlag{ + Name: "scrub-logs", + Usage: "Scrub sensitive information from the shim logs (Windows only)", + }, } // NewContainer creates a new container @@ -176,9 +180,14 @@ func NewContainer(ctx context.Context, client *containerd.Client, cliContext *cl runtime := cliContext.String("runtime") var runtimeOpts any if runtime == "io.containerd.runhcs.v1" { - runtimeOpts = &options.Options{ + opts := &options.Options{ Debug: cliContext.Bool("debug"), } + if cliContext.IsSet("scrub-logs") { + scrubLogs := cliContext.Bool("scrub-logs") + opts.ScrubLogs = &scrubLogs + } + runtimeOpts = opts } cOpts = append(cOpts, containerd.WithRuntime(runtime, runtimeOpts))