Syslifters / sysreptor

A customizable and powerful penetration testing reporting platform for offensive security professionals. Simplify, customize, and automate your pentest reports with ease.
https://docs.sysreptor.com
Other
1.49k stars 142 forks source link

Error on installing - Importing demo project #206

Closed cosad3s closed 8 months ago

cosad3s commented 9 months ago

I have cleaned my sysreptor volumes (docker rm -f sysreptor-app sysreptor-db && docker volume rm -f sysreptor-app-data sysreptor-db-data) to do a clean installation.

I get an error:

❯ curl -s https://docs.sysreptor.com/install.sh | bash
Good to see you.
Get ready for the easiest pentest reporting tool.

Downloading SysReptor from https://github.com/syslifters/sysreptor/releases/latest/download/source-prebuilt.tar.gz ...
Checking download...
Unpacking sysreptor.tar.gz...
Creating app.env...
Generating secret key...
Generating data at rest encryption keys...
No license key found. Going with Community edition.
Creating docker volumes...
Volume: sysreptor-db-data
Volume: sysreptor-app-data
Build and launch SysReptor via docker compose...
We are downloading and installing all dependencies.
This may take a few minutes.
[+] Running 2/2
 ✔ Container sysreptor-db   Healthy                                                                                                                                                                                           3.8s 
 ✔ Container sysreptor-app  Started                                                                                                                                                                                           3.3s 
Running migrations...
Great! Everything seems to be up now.

Setting up initial data...
Creating initial user...
Superuser created successfully.
Importing demo projects...
2024-02-02 11:16:45,843 [ERROR] reportcreator_api.archive.import_export.import_export: Error while importing archive. Rolling back import.
Traceback (most recent call last):
  File "/app/api/reportcreator_api/archive/import_export/import_export.py", line 165, in import_archive
    raise error
  File "/app/api/reportcreator_api/archive/import_export/import_export.py", line 156, in import_archive
    serializer.is_valid(raise_exception=True)
  File "/usr/local/lib/python3.10/site-packages/rest_framework/serializers.py", line 235, in is_valid
    raise ValidationError(self.errors)
rest_framework.exceptions.ValidationError: {'created': [ErrorDetail(string='This field is required.', code='required')], 'project_type': {'created': [ErrorDetail(string='This field is required.', code='required')], 'assets': [{'created': [ErrorDetail(string='This field is required.', code='required')]}]}, 'sections': [{'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}], 'findings': [{'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}], 'images': [{'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}]}
Traceback (most recent call last):
  File "/app/api/manage.py", line 22, in <module>
    main()
  File "/app/api/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/app/api/reportcreator_api/management/commands/importdemodata.py", line 55, in handle
    imported = import_func(f)
  File "/app/api/reportcreator_api/archive/import_export/import_export.py", line 218, in import_projects
    return import_archive(archive_file, serializer_classes=[PentestProjectExportImportSerializer], context={'uploaded_by': uploaded_by})
  File "/usr/local/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/app/api/reportcreator_api/archive/import_export/import_export.py", line 183, in import_archive
    raise ex
  File "/app/api/reportcreator_api/archive/import_export/import_export.py", line 165, in import_archive
    raise error
  File "/app/api/reportcreator_api/archive/import_export/import_export.py", line 156, in import_archive
    serializer.is_valid(raise_exception=True)
  File "/usr/local/lib/python3.10/site-packages/rest_framework/serializers.py", line 235, in is_valid
    raise ValidationError(self.errors)
rest_framework.exceptions.ValidationError: {'created': [ErrorDetail(string='This field is required.', code='required')], 'project_type': {'created': [ErrorDetail(string='This field is required.', code='required')], 'assets': [{'created': [ErrorDetail(string='This field is required.', code='required')]}]}, 'sections': [{'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}], 'findings': [{'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}], 'images': [{'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}, {'created': [ErrorDetail(string='This field is required.', code='required')]}]}
aronmolnar commented 9 months ago

I think that it might be an issue that your docker images are cached with an old version.

Can you remove sysreptor-app by docker rmi sysreptor-app. This will cause the image to be rebuilt from scratch and there should be no more import issues.

(We will update the install script to not cache the images.)

cosad3s commented 9 months ago

You are right @aronmolnar , I retried with your suggestion and it works ;) Cache problem.