Skip to content

fix: sanitize subprocess call in gmtplot.py#246

Merged
Dengda98 merged 1 commit into
Dengda98:mainfrom
orbisai0security:fix-shell-injection-gmtplot-v001
May 11, 2026
Merged

fix: sanitize subprocess call in gmtplot.py#246
Dengda98 merged 1 commit into
Dengda98:mainfrom
orbisai0security:fix-shell-injection-gmtplot-v001

Conversation

@orbisai0security
Copy link
Copy Markdown
Contributor

Summary

Fix high severity security issue in docs/source/_extensions/gmtplot.py.

Vulnerability

Field Value
ID V-001
Severity HIGH
Scanner multi_agent_ai
Rule V-001
File docs/source/_extensions/gmtplot.py:173

Description: The gmtplot.py Sphinx extension invokes subprocess.run() with shell=True at lines 173, 174, and 197, incorporating ps_images[0] — a file path derived from processed documentation source files — directly into the shell command string. When shell=True is used, the entire command string is passed to the OS shell interpreter (/bin/sh), which means any shell metacharacters present in ps_images[0] (such as semicolons, backticks, pipes, or dollar signs) will be interpreted as shell syntax rather than literal path characters. An attacker who can contribute RST documentation files to the repository can craft a filename or path that injects additional shell commands.

Changes

  • docs/source/_extensions/gmtplot.py

Verification

  • Build passes
  • Scanner re-scan confirms fix
  • LLM code review passed

Automated security fix by OrbisAI Security

Automated security fix generated by Orbis Security AI
@Dengda98
Copy link
Copy Markdown
Owner

Thanks!

@Dengda98 Dengda98 merged commit d3fa486 into Dengda98:main May 11, 2026
1 check passed
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.

2 participants