Principle:23blocks OS Ai maestro Input Sanitization
| Knowledge Sources | |
|---|---|
| Domains | Security, Input_Validation |
| Last Updated | 2026-10-26 10:00 GMT |
Overview
A whitelist validation pattern where untrusted user-supplied options are validated against a known per-tool declaration list, dropping anything unknown or invalid.
Description
Input sanitization in AI Maestro follows a strict whitelist approach. The `sanitizeLaunchOptions` function validates user-supplied launch options against a per-tool declaration list. Anything not declared (unknown option id, wrong type, a value that fails its pattern, a choice not on the list) is dropped. A toggle counts only when it is exactly `true`.
This differs from blacklist sanitization (stripping known-bad characters) in that only explicitly allowed values survive. The agent name itself is validated with a regex (`^[a-zA-Z0-9/_.-]+$`) to prevent shell injection via crafted names.
Usage
Use this principle when:
- Untrusted user input feeds into shell commands
- External commands must go through argv, never shell strings
- A known set of valid options exists per tool type
Theoretical Basis
Whitelist validation (allow-listing) is the security principle that only explicitly permitted values pass validation. It is stronger than blacklist validation (deny-listing) because new attack vectors are automatically rejected:
sanitize(kind, raw) =
for each declared option in launchOptionsFor(kind):
if raw[option.id] matches declaration:
include it
else:
drop it
return only included options
The alternative — building tmux/shell commands with string interpolation — is rejected. All external commands go through `execFile` + argv via `lib/tmux-safe.mjs`. Session names must match `^[a-zA-Z0-9_-]+$`.