pyupio / safety

Safety checks Python dependencies for known security vulnerabilities and suggests the proper remediations for vulnerabilities detected.
https://safetycli.com/product/safety-cli
MIT License
1.66k stars 141 forks source link

AttributeError: 'bool' object has no attribute 'get' #538

Open xorr-sm opened 2 weeks ago

xorr-sm commented 2 weeks ago

Description

Ran safety via nox in parallel build in build server. Expected successful safety run without unhandled exceptions.

What I Did

Ran safety in a parallel build via nox. Got JSONDecodeError trying to get the cached database. because of AttributeError: 'bool' object has no attribute 'get'.

Command:
safety --key <our safety key> --stage production --debug true scan --detailed-output --policy-file <our safety file location>/.safety-policy.yml

Traceback: 
 safety.safety => Getting the database from cache at 1718329340.347285, cache setting: 0
 safety.safety => Getting the database from cache at 1718329344.2699468, cache setting: 0
 safety.safety => Getting the database from cache at 1718329344.2699468, cache setting: 0

 safety.safety => JSONDecodeError trying to get the cached database.
 safety.cli_util => Unexpected Exception happened: 'bool' object has no attribute 'get'

Traceback (most recent call last):
  File "<jenkins internal filepath>/.nox/lib/python3.10/site-packages/safety/cli_util.py", line 578, in inner
    return func(ctx, *args, **kwargs)
  File "<jenkins internal filepath>/.nox/lib/python3.10/site-packages/safety/scan/decorators.py", line 327, in inner
    return func(ctx, *args, **kwargs)
  File "<jenkins internal filepath>/.nox/lib/python3.10/site-packages/safety/scan/decorators.py", line 178, in inner
    result = func(ctx, target=target, output=output, *args, **kwargs)
  File "<jenkins internal filepath>/.nox/lib/python3.10/site-packages/safety/scan/command.py", line 291, in scan
    for path, analyzed_file in process_files(paths=file_paths,
  File "<jenkins internal filepath>/.nox/lib/python3.10/site-packages/safety/scan/main.py", line 162, in process_files
    inspectable_file.inspect(config=config)
  File "<jenkins internal filepath>/.nox/lib/python3.10/site-packages/safety/scan/ecosystems/python/main.py", line 289, in inspect
    self.__find_dependency_vulnerabilities__(dependencies=dependencies,
  File "<jenkins internal filepath>/.nox/lib/python3.10/site-packages/safety/scan/ecosystems/python/main.py", line 197, in __find_dependency_vulnerabilities__
    vulnerable_packages = frozenset(db.get('vulnerable_packages', []))

AttributeError: 'bool' object has no attribute 'get'
Unhandled exception happened: 'bool' object has no attribute 'get'