Vulnerability record · PyPI
PYSEC-0000-praisonaiagents-GHSA-cfxv-8fw8-rwpv
Description
Target: PraisonAI (MervinPraison/PraisonAI)
Affected component: praisonaiagents/tools/ast_grep_tool.py — ast_grep_rewrite
Affected versions: master at ce97667156a116c50b4a3d1aa21e09f048903fda; reproduced against the current praisonaiagents PyPI release (praisonaiagents <= 1.6.52).
Tools in praisonaiagents/tools/ that modify on-disk state or run code are uniformly wrapped with @require_approval, which routes the call through an interactive approval flow before the body runs and fails closed — on denial (or with no approval backend configured) it raises PermissionError and the side effect does not occur. This is applied at every sibling mutation entry point:
| File | Line | Symbol | Risk level |
|---|---|---|---|
| file_tools.py | 212 | copy_file | high |
| file_tools.py | 239 | move_file | high |
| file_tools.py | 266 | delete_file | high |
| edit_tools.py | 38 | EditTools.edit_file | high |
| edit_tools.py | 155 | edit_file | high |
| shell_tools.py | 32 | execute_command | critical |
| python_tools.py | 352 | execute_code | critical |
ast_grep_tool.py:149 ast_grep_rewrite is structurally a sibling of these but has no decorator and no from ..approval import require_approval import. With dry_run=False (LLM-controllable), it builds sg --pattern <P> --rewrite <R> --lang <L> --update-all <path> (lines 204–211) and calls subprocess.run(cmd, ...) (line 215), modifying every file under path matching the pattern. There is no approval gate, no _validate_path workspace check, and no cwd= sandboxing. The function is registered as a top-level tool (__init__.py:182) and exposed via the code_intelligence built-in profile (profiles.py).
A secondary defect: on the dry_run=False path ast_grep_rewrite returns the literal string No changes made to the caller even when it modified files (the "No changes made" return at ast_grep_tool.py:230 is reached on this path), so an operator…
Manual fix · PyPI
pip install --upgrade "praisonaiagents>=1.6.58"Sources