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

Copy Test fails because attached file name is too long >100 chars #11314

Open
1 of 3 tasks
antoinbo opened this issue Nov 22, 2024 · 0 comments
Open
1 of 3 tasks

Copy Test fails because attached file name is too long >100 chars #11314

antoinbo opened this issue Nov 22, 2024 · 0 comments
Labels

Comments

@antoinbo
Copy link

Bug description
Copy Test fails because attached file name is too long >100 chars, Test is created but empty.

Steps to reproduce
Steps to reproduce the behavior:

  1. Upload a file to a Test.
  2. Give the file a name with 100 chars.
  3. Copy the test to another Engagement.

Expected behavior
Test is successfully copied to another Engagement, including findings and files.

Deployment method (select with an X)

  • Docker Compose
  • Kubernetes
  • GoDojo

Environment information

  • Operating System: Docker Container on Ubuntu
  • DefectDojo version (see footer) or commit message: v. 2.40.2 ( release mode )

Logs

defectdojo-frontend  | 172.26.0.2 - - [22/Nov/2024:17:12:19 +0000] "GET /test/2336/copy?return_url=/test/2336 HTTP/1.1" 200 10412 "https://localhost/test/2336"
postgres-1           | 2024-11-22 17:12:28.335 UTC [10976] ERROR:  value too long for type character varying(100)
postgres-1           | 2024-11-22 17:12:28.335 UTC [10976] STATEMENT:  INSERT INTO "dojo_fileupload" ("title", "file") VALUES ('LONG_FILENAME - clone-fdfd14aa - clone-e7d2cc4e', 'uploaded_files/8bbbc617-3fc2-4fe1-8505-7f5f8b5267ee.pdf') RETURNING "dojo_fileupload"."id"
uwsgi-1              | [22/Nov/2024 17:12:28] ERROR [django.request:248] Internal Server Error: /test/2336/copy
uwsgi-1              | Traceback (most recent call last):
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
uwsgi-1              |     return self.cursor.execute(sql, params)
uwsgi-1              |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
uwsgi-1              |     raise ex.with_traceback(None)
uwsgi-1              | psycopg.errors.StringDataRightTruncation: value too long for type character varying(100)
uwsgi-1              |
uwsgi-1              | The above exception was the direct cause of the following exception:
uwsgi-1              |
uwsgi-1              | Traceback (most recent call last):
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
uwsgi-1              |     response = get_response(request)
uwsgi-1              |                ^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
uwsgi-1              |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
uwsgi-1              |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/app/dojo/authorization/authorization_decorators.py", line 36, in _wrapped
uwsgi-1              |     return func(request, *args, **kwargs)
uwsgi-1              |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/app/dojo/test/views.py", line 368, in copy_test
uwsgi-1              |     test_copy = test.copy(engagement=engagement)
uwsgi-1              |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/app/dojo/models.py", line 2124, in copy
uwsgi-1              |     copy.files.add(files.copy())
uwsgi-1              |                    ^^^^^^^^^^^^
uwsgi-1              |   File "/app/dojo/models.py", line 731, in copy
uwsgi-1              |     copy.save()
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 891, in save
uwsgi-1              |     self.save_base(
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 997, in save_base
uwsgi-1              |     updated = self._save_table(
uwsgi-1              |               ^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 1160, in _save_table
uwsgi-1              |     results = self._do_insert(
uwsgi-1              |               ^^^^^^^^^^^^^^^^
defectdojo-frontend  | 172.26.0.2 - - [22/Nov/2024:17:12:28 +0000] "POST /test/2336/copy?return_url=/test/2336 HTTP/1.1" 500 44715 "https://localhost/test/2336/copy?return_url=/test/2336"
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 1201, in _do_insert
uwsgi-1              |     return manager._insert(
uwsgi-1              |            ^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
uwsgi-1              |     return getattr(self.get_queryset(), name)(*args, **kwargs)
uwsgi-1              |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1847, in _insert
uwsgi-1              |     return query.get_compiler(using=using).execute_sql(returning_fields)
uwsgi-1              |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1836, in execute_sql
uwsgi-1              |     cursor.execute(sql, params)
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
uwsgi-1              |     return self._execute_with_wrappers(
uwsgi-1              |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
uwsgi-1              |     return executor(sql, params, many, context)
uwsgi-1              |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
uwsgi-1              |     with self.db.wrap_database_errors:
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
uwsgi-1              |     raise dj_exc_value.with_traceback(traceback) from exc_value
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
uwsgi-1              |     return self.cursor.execute(sql, params)
uwsgi-1              |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1              |   File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
uwsgi-1              |     raise ex.with_traceback(None)
uwsgi-1              | django.db.utils.DataError: value too long for type character varying(100)

Sample scan files
N/A

Screenshots
image

Additional context (optional)
N/A

@antoinbo antoinbo added the bug label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant