Documentation
¶
Overview ¶
Package config loads Emberwire's runtime configuration.
Node-RED's settings.js is executable JavaScript: adminAuth can be a function, https can be a function returning cert options, storageModule is a require(). That makes it impossible to validate, diff, template from a ConfigMap, or reason about without running it. Emberwire's configuration is declarative YAML with environment overrides, which is what a Helm chart can actually produce and what an operator can actually review.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
CheckPassword verifies a plaintext password against a stored hash in constant time.
func HashPassword ¶
HashPassword produces a bcrypt hash for the hash-password command.
Types ¶
type Auth ¶
type Auth struct {
// Enabled defaults to true. Starting without it requires an explicit
// opt-out, because Node-RED shipping unauthenticated by default is the root
// cause of CVE-2025-41656 — unauthenticated RCE by deploying a flow with an
// exec node in it. Node-RED's own team proposed exactly this fix in
// designs#81 and did not ship it.
Enabled bool `yaml:"enabled"`
Users []User `yaml:"users"`
// SessionTTL bounds how long an issued token is good for.
SessionTTL time.Duration `yaml:"sessionTTL"`
}
Auth controls access to the editor and admin API.
type Config ¶
type Config struct {
Server Server `yaml:"server"`
Data Data `yaml:"data"`
Auth Auth `yaml:"auth"`
Runtime Runtime `yaml:"runtime"`
Discovery Discovery `yaml:"discovery"`
Exec Exec `yaml:"exec"`
Files Files `yaml:"files"`
Logging Logging `yaml:"logging"`
Metrics Metrics `yaml:"metrics"`
}
Config is the whole configuration surface.
func Default ¶
func Default() Config
Default returns the configuration used when nothing is specified.
func Load ¶
Load reads a configuration file, applies environment overrides and validates the result. An empty path uses the defaults plus the environment.
func (*Config) CredentialsPath ¶
CredentialsPath is the absolute path to the credential store.
type Data ¶
type Data struct {
Dir string `yaml:"dir"`
FlowFile string `yaml:"flowFile"`
CredentialsFile string `yaml:"credentialsFile"`
// CredentialSecret encrypts the credential store. Leaving it empty writes
// credentials in plaintext, which is refused unless AllowPlaintextCredentials
// is set — see Validate.
CredentialSecret string `yaml:"credentialSecret"`
AllowPlaintextCredentials bool `yaml:"allowPlaintextCredentials"`
BackupGenerations int `yaml:"backupGenerations"`
}
Data is where state lives. All of it under one directory, which is the PVC.
type Discovery ¶
type Discovery struct {
Enabled bool `yaml:"enabled"`
// AllowedCIDRs bounds what the scan nodes may probe. This is a plant-floor
// inventory tool, not a scanner somebody can aim anywhere from an edit
// dialog, so an empty list with discovery enabled is a configuration error
// rather than "scan everything".
AllowedCIDRs []string `yaml:"allowedCIDRs"`
}
Discovery gates the network discovery nodes.
type ErrInsecure ¶
type ErrInsecure struct{ Reason string }
ErrInsecure is returned when authentication is disabled without the explicit opt-out. It is a distinct type so main can print the remedy rather than a bare error.
func (*ErrInsecure) Error ¶
func (e *ErrInsecure) Error() string
type Exec ¶
type Exec struct {
Enabled bool `yaml:"enabled"`
// AllowedCommands lists what a flow may run. Entries are matched on the
// resolved absolute path, so naming "curl" allows the curl on the PATH at
// the time and not whatever a later mount puts in front of it.
AllowedCommands []string `yaml:"allowedCommands"`
}
Exec gates the exec node.
Off by default, and an enabled node with no allowed commands is a configuration error rather than "anything goes". Node-RED's exec node against a default configuration is CVE-2025-41656 — unauthenticated remote code execution, reached by deploying a flow — and the reason it is that severe is that nothing between "can edit a flow" and "can run any command" exists. This is that thing.
type Files ¶
type Files struct {
// AllowedPaths are extra directory trees on top of the data directory.
AllowedPaths []string `yaml:"allowedPaths"`
}
Files bounds where the file nodes may read and write.
Unlike the exec node this is on by default, scoped to the data directory. A flow reading and writing under its own PVC is the ordinary case; reaching outside it is not, and Node-RED's file nodes taking any path is what makes "can edit a flow" mean "can read any file this process can".
type Runtime ¶
type Runtime struct {
InboxCapacity int `yaml:"inboxCapacity"`
Overflow string `yaml:"overflow"`
BlockTimeout time.Duration `yaml:"blockTimeout"`
CloseTimeout time.Duration `yaml:"closeTimeout"`
}
Runtime tunes the scheduler.
type Server ¶
type Server struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
// AdminRoot is the path prefix the editor and admin API are served under.
// The App Store proxies apps by path, so this has to be settable.
AdminRoot string `yaml:"adminRoot"`
// HTTPRoot is the prefix a flow's HTTP In nodes are served under, matching
// Node-RED's httpNodeRoot. It may be the same as AdminRoot — the fixed admin
// routes are more specific and still win — and a flow that tries to claim a
// path belonging to the editor or the API is refused at deploy time.
HTTPRoot string `yaml:"httpRoot"`
ReadTimeout time.Duration `yaml:"readTimeout"`
WriteTimeout time.Duration `yaml:"writeTimeout"`
ShutdownTimeout time.Duration `yaml:"shutdownTimeout"`
// MaxRequestBytes bounds a flow deploy. A flow file is the largest thing
// the API accepts and an unbounded body is a trivial way to OOM an edge box.
MaxRequestBytes int64 `yaml:"maxRequestBytes"`
}
Server is the HTTP listener.
type User ¶
type User struct {
Username string `yaml:"username"`
// PasswordHash is a bcrypt hash. Plaintext passwords are refused, so a
// ConfigMap can never contain one by accident.
PasswordHash string `yaml:"passwordHash"`
// Permissions is "*" for full access, or a list such as ["flows.read"].
Permissions []string `yaml:"permissions"`
}
User is a local account.