subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run_gog(query): """Run gog command and return JSON""" try: result = subprocess.run( f"gog gmail search '{query} newer_than:30d' --max 5 --json", shell=True, capture_output=True,- Confidence
- 96% confidence
- Finding
- The code builds a shell command with an f-string and executes it with shell=True, which creates a command-injection sink. Although the current NEWSLETTERS list is hard-coded, the helper accepts arbitrary query input and the shell will interpret quotes and metacharacters if that input ever becomes configurable or is influenced by external data.
