subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
pattern = ".*".join(words) try: result = subprocess.run( ["grep", "-rl", "-i", pattern, "knowledge/chunks/"], capture_output=True, text=True,- Confidence
- 90% confidence
- Finding
- The code builds a grep regex directly from user-controlled query words and passes it to an external process. Although it does not use shell=True, this still allows regex/option-style abuse and expensive pattern execution against a large corpus, creating a command-invocation surface and potential denial-of-service or unintended matching behavior.
