This is an automated email from the ASF dual-hosted git repository. squakez pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 8b9676214cc66a8c96e29fedc8a2b04dbac7e03e Author: Suhail Hany <[email protected]> AuthorDate: Mon Sep 21 20:14:00 2026 +0300 Fix #6829: drop the child context left with no canceller syncIntegration held the only call to RootCmdOptions.ContextCancel, so removing it left the cancel func returned by WithCancel uncalled, which is what gosec G118 reports at root.go:55. The child context existed only so sync could cancel and restart the in-flight command, so drop it along with the now-unused ContextCancel field. RootContext keeps its meaning and run.go is untouched. --- pkg/cmd/root.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go index 8f03ccdb0..6151f5404 100644 --- a/pkg/cmd/root.go +++ b/pkg/cmd/root.go @@ -40,24 +40,21 @@ superpowers. // //nolint:containedctx type RootCmdOptions struct { - RootContext context.Context `mapstructure:"-"` - Context context.Context `mapstructure:"-"` - ContextCancel context.CancelFunc `mapstructure:"-"` - _client client.Client `mapstructure:"-"` - Flags *viper.Viper `mapstructure:"-"` - KubeConfig string `mapstructure:"kube-config"` - Namespace string `mapstructure:"namespace"` - Verbose bool `mapstructure:"verbose" yaml:",omitempty"` + RootContext context.Context `mapstructure:"-"` + Context context.Context `mapstructure:"-"` + _client client.Client `mapstructure:"-"` + Flags *viper.Viper `mapstructure:"-"` + KubeConfig string `mapstructure:"kube-config"` + Namespace string `mapstructure:"namespace"` + Verbose bool `mapstructure:"verbose" yaml:",omitempty"` } // NewKamelCommand --. func NewKamelCommand(ctx context.Context) (*cobra.Command, error) { - childCtx, childCancel := context.WithCancel(ctx) options := RootCmdOptions{ - RootContext: ctx, - Context: childCtx, - ContextCancel: childCancel, - Flags: viper.New(), + RootContext: ctx, + Context: ctx, + Flags: viper.New(), } cmd := kamelPreAddCommandInit(&options)
