airlock_exec
Runs local subprocesses with .env credentials injected and scrubs secrets/PII from stdout and stderr, so tests, migrations, and scripts can use live credentials without leaking sensitive output.
Instructions
Run a local subprocess with .env credentials injected and scrub secrets/PII from its output.
Purpose & Behavior:
Executes `command` directly via `subprocess.run(..., shell=False)` with a 30-second timeout inside the
allowed workspace. If `env_file` is provided, parses `KEY=VALUE` pairs, injects the real unmasked values
into the child process environment, and registers those secrets in the session vault. Before returning,
both `stdout` and `stderr` are scrubbed so printed secrets and stack-trace leaks become `<ENTITY_N>`
placeholders.
When to Use:
- Use this instead of native bash/terminal execution whenever running tests (`pytest`), migrations, or
scripts that need live `.env` credentials or may print sensitive values.
- Pass commands as a tokenized list of strings (`["pytest", "tests/"]`), never as a single shell string.
- Use `airlock_scrub_text` when you only need to sanitize already-captured output without running anything.
Returns:
A JSON-serializable object with `{"exit_code": int, "stdout": str, "stderr": str}` where both streams have
secrets replaced by `<ENTITY_N>` placeholders. Timeouts and launch failures return `exit_code: -1` with a
scrubbed explanatory `stderr`. Raises a tool error for disallowed executables or invalid commands.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"command": "<command>"
},
"name": "airlock_exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | Argv command list to execute without a shell (e.g., ['pytest', '-v'] or ['python', 'scripts/check.py']). The first element is the executable and subsequent elements are literal arguments. | |
| env_file | No | Optional path to a local .env file (KEY=VALUE lines) whose raw secrets are injected into the child process environment at runtime and registered in the session vault so any leaked values in stdout/stderr are scrubbed. |