Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions src/lib/server/creator-mission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1742,29 +1742,10 @@ const VALIDATION_EXECUTABLE_ALLOWLIST = new Set(['node', 'python', 'python3', 'p

// Interpreters that accept flags to execute arbitrary code snippets.
const INTERPRETER_EXECUTABLES = new Set(['node', 'python', 'python3', 'py']);
// Flags that cause interpreters to evaluate an arbitrary code string from the argument
// line (or read a program from stdin).
// Flags that cause interpreters to evaluate arbitrary code from the argument string.
// A command like `python -c "os.system('rm -rf /')"` would pass the allowlist
// because only the executable name is checked. These inline-eval flags must be rejected.
// Covers node (-e/--eval, -p/--print), python (-c/--command) and the bare `-`
// stdin-program form. This list must include every interpreter flag that evaluates an
// argument string or stdin program rather than naming a script/module on disk.
//
// NOTE: `-m`/`--module` is intentionally NOT listed. `python -m <module>` runs a named,
// importable module (e.g. `python -m pytest tests`) — it executes installed code on disk,
// exactly like running a script file, and never evaluates an arbitrary inline string. It
// is a first-class validation pattern here (the default manifest validation command is
// `python -m pytest tests`, and the planner shells out `python -m spark_intelligence.cli`),
// so blocking it would break legitimate runs.
const DANGEROUS_INTERPRETER_FLAGS = new Set([
'-c',
'--command',
'-e',
'--eval',
'-p',
'--print',
'-'
]);
// because only the executable name is checked. These flags must be rejected.
const DANGEROUS_INTERPRETER_FLAGS = new Set(['-c', '--command', '-e', '--eval', '-']);

function splitCommandLine(command: string): string[] {
const parts: string[] = [];
Expand Down