Skip to content

fix: avoid shell interpolation in permission dialogs#197

Open
MackDing wants to merge 1 commit into
simular-ai:mainfrom
MackDing:fix/permission-dialog-shell-injection
Open

fix: avoid shell interpolation in permission dialogs#197
MackDing wants to merge 1 commit into
simular-ai:mainfrom
MackDing:fix/permission-dialog-shell-injection

Conversation

@MackDing

Copy link
Copy Markdown

Summary

  • replace shell-based os.system(...) permission prompts with subprocess.run(...)
  • pass dialog content as argv data instead of interpolating model-generated text into shell commands
  • apply the fix across the S1, S2, S2.5, and S3 CLI entrypoints

Problem

The permission dialog code interpolated model-generated code and action_description into shell command strings for osascript and zenity. That allowed shell metacharacters or broken quoting in the generated action text to execute commands before user approval.

Fix

  • macOS: call osascript with a fixed script and pass the prompt text as an argument
  • Linux: call zenity with argv items instead of a shell string
  • preserve existing behavior while treating the displayed action text strictly as data

Verification

  • python3 -m py_compile gui_agents/s1/cli_app.py gui_agents/s2/cli_app.py gui_agents/s2_5/cli_app.py gui_agents/s3/cli_app.py

Closes #196

@MackDing

Copy link
Copy Markdown
Author

Quick follow-up: this PR appears mergeable from my side, and I do not see a failing required check. Happy to make any maintainer-preferred tweak if needed.

@MackDing

Copy link
Copy Markdown
Author

Checking in on this PR. The branch is still open, but GitHub is showing an unstable or incomplete status.

Please let me know if you want changes from my side, or if this should be rerun/reviewed by maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permission dialogs execute unescaped model-generated text via os.system on macOS/Linux

1 participant