exec

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package exec contains the exec node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecConfig

type ExecConfig struct {
	// Command is the base command line to run through the system shell.
	Command string `json:"command"`
	// AddPay names a payload/metadata property whose value is appended
	// VERBATIM to the command line (empty = nothing appended). This is
	// Node-RED parity — the shell expands it, so an addpay fed by
	// untrusted input (e.g. an httpTrigger body) can inject shell
	// syntax. Only enable exec (AllowExec) on trusted flows.
	AddPay string `json:"addpay"`
	// Append holds extra arguments appended after the addpay value.
	Append string `json:"append"`
	// Timer is a kill timeout in seconds (0 = no timeout).
	Timer float64 `json:"timer"`
}

ExecConfig holds configuration for the exec node — the Node-RED `exec` equivalent (buffered mode only).

type ExecNode

type ExecNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

ExecNode runs a system command and returns stdout/stderr/rc.

SECURITY: arbitrary command execution is gated behind WorkflowEngine.ExecAllowed() — the node fails with "exec disabled" unless the flag is set (env GOFLOW_ALLOW_EXEC=1 wires it in main). The addpay value is concatenated into the shell command line exactly like Node-RED does, so even an enabled exec node is only as safe as the messages routed into it.

func NewExecNode

func NewExecNode(node nodestore.NodeInterface, config *ExecConfig, host nodebase.NodeHost) *ExecNode

NewExecNode creates a new exec node

func (*ExecNode) Execute

Execute builds the full command line (command + addpay-resolved value + append), runs it buffered through the shell and returns stdout as Data with rc/stderr in Metadata.

func (*ExecNode) SelectPorts

func (n *ExecNode) SelectPorts(input, output nodestore.MessageInterface) []string

SelectPorts routes rc 0 to output_1 (stdout); a non-zero exit goes to output_3 (Node-RED's "return code" port) carrying stderr + rc.

func (*ExecNode) Validate

func (n *ExecNode) Validate() error

Validate checks the exec node configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL