tcosolutions / betterscan

Code Scanning/SAST/Static Analysis/Linting using many tools/Scanners with One Report (Code, IaC) - Betterscan
https://betterscan.io
GNU Affero General Public License v3.0
818 stars 90 forks source link

NameError: name 'Backend' is not defined #204

Closed ZumiYumi closed 1 month ago

ZumiYumi commented 1 month ago

Hello, I am receiving the error NameError: name 'Backend' is not defined

Full error output:

/root
/home/cve/platform-application
/home/cve/platform-application
Loading plugin: git
Loading plugin: bandit
Loading plugin: brakeman
Loading plugin: tfsec
Loading plugin: kubescape
Loading plugin: semgrepjava
Loading plugin: semgrepeslint
Loading plugin: graudit
Loading plugin: text4shell
Loading plugin: gostaticcheck
Loading plugin: gptanalyzer
Traceback (most recent call last):
  File "/usr/local/bin/checkmate", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/checkmate/scripts/manage.py", line 90, in main
    backend = get_backend(project_path, project_config, settings)
  File "/usr/local/lib/python3.8/site-packages/checkmate/management/helpers.py", line 124, in get_backend
    backend = Backend()  # Assuming this is a default generic backend class
NameError: name 'Backend' is not defined

System information: Hyper-V Ubuntu NAME="Ubuntu" VERSION="20.04.6 LTS (Focal Fossa)"

Steps to recreate:

  1. clone application I wish to scan: https://github.com/oroinc/platform-application git clone https://github.com/oroinc/platform-application
  2. cd platform-application
  3. as a regular user sh <(curl https://raw.githubusercontent.com/tcosolutions/betterscan/main/cli.sh) Error occurs
marcinguy commented 1 month ago

@ZumiYumi thanks for reporting. I will look into in when I am back from vacations

marcinguy commented 3 weeks ago

@ZumiYumi On my second laptop (Linux, Ubuntu 22.04 LTS, amd64) I get a different error. Not sure what is the problem in your issue/how to replicate it (please use your Python knowledge to troubleshoot)

I also added checkmate parameters/options descriptions for more customizations/better description vs just in code and shell script.

ZumiYumi commented 3 weeks ago

Hmmm, okay @marcinguy :) I'll try to investigate it this weekend. Thank you for your time

marcinguy commented 3 weeks ago

@ZumiYumi u can try llm to debug the issue (uploading source zipfile to OpenAI gpt 4o or Claude or other llm of choice)

vscode has now llm integrations (many models I read) or cursor ai or GitHub copilot

Was pretty good when I used it

cchaniotaki commented 2 weeks ago

I am also getting this error. I have a macOS. Traceback (most recent call last): File "/usr/local/bin/checkmate", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/site-packages/checkmate/scripts/manage.py", line 90, in main backend = get_backend(project_path, project_config, settings) File "/usr/local/lib/python3.8/site-packages/checkmate/management/helpers.py", line 124, in get_backend backend = Backend() # Assuming this is a default generic backend class NameError: name 'Backend' is not defined /root

leaviljanen commented 2 weeks ago

I am getting a related error on the latest on VMWare guest Debian 12 The error is the same whether I use the sh < curl or run the worker-cli manually

user@debian:~/projects/ttt/src/.checkmate$ sudo docker run -e CODE_DIR=$CODE_DIR -e OPENAI_GPT_API -v ${CODE_DIR}:${CODE_DIR} -ti tcosolutions/betterscan-worker-cli:latest /bin/sh -c "cd $CODE_DIR && git config --global --add safe.directory $CODE_DIR && checkmate init --backend sqlite --backend-opts \"sqlite:////${CODE_DIR}/.checkmate/database.db\""
Traceback (most recent call last):
  File "/usr/local/bin/checkmate", line 5, in <module>
    from checkmate.scripts.manage import main
  File "/usr/local/lib/python3.8/site-packages/checkmate/scripts/manage.py", line 23, in <module>
    from checkmate.management import helpers, commands
  File "/usr/local/lib/python3.8/site-packages/checkmate/management/helpers.py", line 12, in <module>
    from checkmate.lib.backend import Backend
  File "/usr/local/lib/python3.8/site-packages/checkmate/lib/backend.py", line 2, in <module>
    from blitzdb.backends.sql import Backend as BlitzDBSQLBackend
  File "/usr/local/lib/python3.8/site-packages/blitzdb/backends/sql/__init__.py", line 22, in <module>
    from .backend import Backend
ImportError: cannot import name 'Backend' from 'blitzdb.backends.sql.backend' (/usr/local/lib/python3.8/site-packages/blitzdb/backends/sql/backend.py)

As if the sqlite directive isn't really sticking, blitzdb isn't sqlite?