Skip to content
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

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

Open
xorr-sm opened this issue Jun 14, 2024 · 3 comments
Open

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

xorr-sm opened this issue Jun 14, 2024 · 3 comments
Assignees
Labels
bug Indicates a problem that needs to be resolved.

Comments

@xorr-sm
Copy link

xorr-sm commented Jun 14, 2024

  • safety version: 3.2.0
  • Python version: 3.10
  • Operating System: Ubuntu 22.04.3

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'

@dylanpulver
Copy link
Collaborator

This has been addressed here: #544

@yeisonvargasf yeisonvargasf added the bug Indicates a problem that needs to be resolved. label Jul 4, 2024
@yeisonvargasf
Copy link
Member

Thanks, @xorr-sm, for this issue report. The fix is present in the 3.2.4 release; to close this issue, we would like you to confirm that the bug is solved when using the latest version.

@xorr-sm
Copy link
Author

xorr-sm commented Jul 16, 2024

We have integrated version 3.2.4 into our system and we haven't see any failing builds due to this error. This has resolved the issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates a problem that needs to be resolved.
Projects
None yet
Development

No branches or pull requests

3 participants