MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / AddToWhitelist

Method AddToWhitelist

internal/plugins/command-runner/executor.go:299–310  ·  view source on GitHub ↗

AddToWhitelist adds a command to the in-memory whitelist for a target type. This change is session-only and does not persist to the config file.

(targetType TargetType, command string)

Source from the content-addressed store, hash-verified

297// AddToWhitelist adds a command to the in-memory whitelist for a target type.
298// This change is session-only and does not persist to the config file.
299func (e *Executor) AddToWhitelist(targetType TargetType, command string) {
300 switch targetType {
301 case TargetHost:
302 e.config.AllowedCommands.Host = append([]string{command}, e.config.AllowedCommands.Host...)
303 case TargetContainer:
304 e.config.AllowedCommands.Container = append([]string{command}, e.config.AllowedCommands.Container...)
305 case TargetVM:
306 e.config.AllowedCommands.VM = append([]string{command}, e.config.AllowedCommands.VM...)
307 }
308 // Refresh the validator so it picks up the new entry.
309 e.validator = NewValidator(e.config)
310}
311
312// ExecuteCustomHostCommand executes an arbitrary command on a host via SSH without
313// whitelist validation. The command must be non-interactive; sudo requiring a password

Callers 1

showCustomResultModalMethod · 0.80

Calls 1

NewValidatorFunction · 0.85

Tested by

no test coverage detected