8000 Added resolution of installed packages by jakub-safetycli · Pull Request #730 · pyupio/safety · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added resolution of installed packages #730

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

Merged
merged 1 commit into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .safety-project.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
id = safety
url = /projects/aa1f1929-42d3-4fb7-8e6c-f9e187a832a2/findings
url = /codebases/safety/findings
name = safety

11 changes: 9 additions & 2 deletions safety/tool/pip/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from tempfile import mkstemp
from typing import TYPE_CHECKING, Any, List, Optional

import logging
from rich.padding import Padding
import typer

Expand All @@ -23,6 +24,8 @@
if TYPE_CHECKING:
from ..environment_diff import EnvironmentDiffTracker

logger = logging.getLogger(__name__)


class PipCommand(BaseCommand):
"""
Expand Down Expand Up @@ -182,12 +185,16 @@ def __render_package_details(self):

def __audit_packages(self, ctx: typer.Context) -> Any:
try:
added, _, updated = self._diff_tracker.get_diff()
packages = {**added, **updated}

return ctx.obj.auth.client.audit_packages(
[
f"{package_name}{version if version else ''}"
for (package_name, version) in self.__packages
f"{package_name}=={version[1] if len(version) > 1 else version}"
for (package_name, version) in packages.items()
]
)
except Exception:
logger.debug("Audit API failed with error", exc_info=True)
# do not propagate the error in case the audit failed
return dict()
Loading
0