-
-
Notifications
You must be signed in to change notification settings - Fork 49
Security: Unified Package Manager with Shell Injection Protection #530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a1afbf8
0779dd9
c603ce4
3717fea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
|
|
||
| import re | ||
| import subprocess | ||
| import shlex | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Import added but misused in subprocess calls. While the import is syntactically correct, 🤖 Prompt for AI Agents |
||
| from enum import Enum | ||
|
|
||
|
|
||
|
|
@@ -439,7 +440,7 @@ def get_package_info(self, package_name: str) -> dict[str, str] | None: | |
| try: | ||
| if self.pm_type == PackageManagerType.APT: | ||
| result = subprocess.run( | ||
| ["apt-cache", "show", package_name], capture_output=True, text=True, timeout=10 | ||
| ["apt-cache", "show", shlex.quote(package_name)], capture_output=True, text=True, timeout=10 | ||
| ) | ||
| if result.returncode == 0: | ||
| info = {} | ||
|
|
@@ -452,7 +453,7 @@ def get_package_info(self, package_name: str) -> dict[str, str] | None: | |
| elif self.pm_type in (PackageManagerType.YUM, PackageManagerType.DNF): | ||
| pm_cmd = "yum" if self.pm_type == PackageManagerType.YUM else "dnf" | ||
| result = subprocess.run( | ||
| [pm_cmd, "info", package_name], capture_output=True, text=True, timeout=10 | ||
| [pm_cmd, "info", shlex.quote(package_name)], capture_output=True, text=True, timeout=10 | ||
| ) | ||
| if result.returncode == 0: | ||
| info = {} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Security implementation file missing from review.
The PR title and description claim to implement "Shell Injection Protection" in
cortex/packages.pyusingshlex.quote()for package names. However, that file is not included in this review—only the CLA signers file is provided.Security-critical changes must be reviewed to verify:
shlex.quote()for all external command invocationsPlease include
cortex/packages.pyin this PR for review, or clarify why the primary security implementation is not shown.🤖 Prompt for AI Agents