Unverified Commit 4d12a19a authored by dotlambda's avatar dotlambda Committed by GitHub
Browse files

python313Packages.safety: 3.3.1 -> 3.4.0 (#401725)

parents 2d64d17b 0f5498d9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -12,13 +12,13 @@

buildPythonPackage rec {
  pname = "safety-schemas";
  version = "0.0.12";
  version = "0.0.14";
  pyproject = true;

  src = fetchPypi {
    pname = "safety_schemas";
    inherit version;
    hash = "sha256-i4ejATIA9MDv+ZmCxnj5roYkeKPaKqk07AcCH3/AtcA=";
    hash = "sha256-SZU/elnpGVcr4lWVqJRvnLvNIGb+PhYMlGfZ0dbXr2o=";
  };

  postPatch = ''
+13 −17
Original line number Diff line number Diff line
@@ -20,34 +20,30 @@
  typing-extensions,
  filelock,
  psutil,
  httpx,
  tenacity,
  tomlkit,
  git,
  pytestCheckHook,
  tomli,
  writableTmpDirAsHomeHook,
}:

buildPythonPackage rec {
  pname = "safety";
  version = "3.3.1";
  version = "3.4.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pyupio";
    repo = "safety";
    tag = version;
    hash = "sha256-u+ysRpWLHDQdNRBSlYXz80e/MCT4smmv/YX8sfIrn24=";
    hash = "sha256-CyEBgB3YgTQDzqJloL0XaRF0h6soNOWmtWTjP423MmY=";
  };

  postPatch = ''
    substituteInPlace safety/safety.py \
      --replace-fail "telemetry: bool = True" "telemetry: bool = False"
    substituteInPlace safety/util.py \
      --replace-fail "telemetry: bool = True" "telemetry: bool = False"
    substituteInPlace safety/cli.py \
      --replace-fail "disable-optional-telemetry', default=False" \
                     "disable-optional-telemetry', default=True"
    substituteInPlace safety/scan/finder/handlers.py \
      --replace-fail "telemetry=True" "telemetry=False"
  '';
  patches = [
    ./disable-telemetry.patch
  ];

  build-system = [ hatchling ];

@@ -74,12 +70,16 @@ buildPythonPackage rec {
    typing-extensions
    filelock
    psutil
    httpx
    tenacity
    tomlkit
  ];

  nativeCheckInputs = [
    git
    pytestCheckHook
    tomli
    writableTmpDirAsHomeHook
  ];

  disabledTests = [
@@ -95,10 +95,6 @@ buildPythonPackage rec {
  # ImportError: cannot import name 'get_command_for' from partially initialized module 'safety.cli_util' (most likely due to a circular import)
  disabledTestPaths = [ "tests/alerts/test_utils.py" ];

  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  meta = {
    description = "Checks installed dependencies for known vulnerabilities";
    mainProgram = "safety";
+57 −0
Original line number Diff line number Diff line
diff --git a/safety/cli.py b/safety/cli.py
index 4d1f0c5..db4d930 100644
--- a/safety/cli.py
+++ b/safety/cli.py
@@ -228,7 +228,7 @@ def configure_logger(ctx, param, debug):
 @proxy_options
 @click.option(
     "--disable-optional-telemetry",
-    default=False,
+    default=True,
     is_flag=True,
     show_default=True,
     help=CLI_DISABLE_OPTIONAL_TELEMETRY_DATA_HELP,
diff --git a/safety/safety.py b/safety/safety.py
index e41f5ae..7d29a50 100644
--- a/safety/safety.py
+++ b/safety/safety.py
@@ -143,7 +143,7 @@ def fetch_database_url(
     mirror: str,
     db_name: str,
     cached: int,
-    telemetry: bool = True,
+    telemetry: bool = False,
     ecosystem: Ecosystem = Ecosystem.PYTHON,
     from_cache: bool = True
 ) -> Dict[str, Any]:
diff --git a/safety/scan/finder/handlers.py b/safety/scan/finder/handlers.py
index 80a3db6..61a10cc 100644
--- a/safety/scan/finder/handlers.py
+++ b/safety/scan/finder/handlers.py
@@ -91,11 +91,11 @@ class PythonFileHandler(FileHandler):
 
         # Fetch both the full and partial Safety databases
         fetch_database(session=session, full=False, db=db, cached=True,
-                       telemetry=True, ecosystem=Ecosystem.PYTHON,
+                       telemetry=False, ecosystem=Ecosystem.PYTHON,
                        from_cache=False)
 
         fetch_database(session=session, full=True, db=db, cached=True,
-                                telemetry=True, ecosystem=Ecosystem.PYTHON,
+                                telemetry=False, ecosystem=Ecosystem.PYTHON,
                                 from_cache=False)
 
 
diff --git a/safety/util.py b/safety/util.py
index 2a02236..5feef8d 100644
--- a/safety/util.py
+++ b/safety/util.py
@@ -351,7 +351,7 @@ def filter_announcements(
 
 
 def build_telemetry_data(
-    telemetry: bool = True,
+    telemetry: bool = False,
     command: Optional[str] = None,
     subcommand: Optional[str] = None,
 ) -> TelemetryModel: