Skip to content

Commit e04f9c4

Browse files
committed
fix(command-runner): prepend whitelisted commands so they appear first on re-open
1 parent 1c53d3f commit e04f9c4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

internal/plugins/command-runner/executor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,11 @@ func (e *Executor) GetAllowedVMCommands(vm VM) []string {
299299
func (e *Executor) AddToWhitelist(targetType TargetType, command string) {
300300
switch targetType {
301301
case TargetHost:
302-
e.config.AllowedCommands.Host = append(e.config.AllowedCommands.Host, command)
302+
e.config.AllowedCommands.Host = append([]string{command}, e.config.AllowedCommands.Host...)
303303
case TargetContainer:
304-
e.config.AllowedCommands.Container = append(e.config.AllowedCommands.Container, command)
304+
e.config.AllowedCommands.Container = append([]string{command}, e.config.AllowedCommands.Container...)
305305
case TargetVM:
306-
e.config.AllowedCommands.VM = append(e.config.AllowedCommands.VM, command)
306+
e.config.AllowedCommands.VM = append([]string{command}, e.config.AllowedCommands.VM...)
307307
}
308308
// Refresh the validator so it picks up the new entry.
309309
e.validator = NewValidator(e.config)

0 commit comments

Comments
 (0)