Files
Ignacy Łątka 03325e518f fix(flows): validate name to close path-traversal in getFlowPath
The unsanitized `name` parameter was joined into
  <project_root>/.argent/flows/<name>.yaml
so a name like "../../../tmp/x" landed the YAML file at an
attacker-chosen path. Combined with the no-auth/wildcard-CORS HTTP
surface, a cross-origin browser POST could write attacker-controlled
YAML anywhere the user can write — .github/workflows/*.yaml,
docker-compose.yml, etc.

Adds assertSafeFlowName() in flow-utils.ts. getFlowPath() now requires
^[A-Za-z0-9_\-]+$ (letters, digits, underscore, hyphen — no separators,
no "..", no spaces) and additionally checks that the resolved path
stays inside the flows directory via path.relative.

Centralizing the check in getFlowPath() means every caller
(flow-start-recording, flow-add-step, flow-insert-echo,
flow-finish-recording, flow-run, flow-read-prerequisite) is covered
without per-tool churn.
2026-05-07 15:14:39 +02:00
..