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

'Top 5 Users' on dashboard broke after update 6.1.0 > 6.2.0 #2667

Open
KaiseerKenopsia opened this issue Jan 9, 2025 · 4 comments
Open

'Top 5 Users' on dashboard broke after update 6.1.0 > 6.2.0 #2667

KaiseerKenopsia opened this issue Jan 9, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@KaiseerKenopsia
Copy link

What happened

'Top 5 Users' panel on dashboard broke after updating from 6.1.0 to 6.2.0, showing a very long 500 error

Environment

  1. OS: Docker containers on Kubernetes
  2. IntelOwl version: 6.2.0

What did you expect to happen

For the panel to keep working

How to reproduce your issue

Update containers from ver 6.1.0 to ver 6.2.0, maybe with some specific annotations or similiar

Error messages and logs

/var/log/intel_owl/django/django_errors.log

2025-01-09 13:45:11,829 - django.request - log_response - ERROR - Internal Server Error: /api/jobs/aggregate/top_user
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/rest_framework/viewsets.py", line 124, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/deploy/intel_owl/api_app/views.py", line 810, in aggregate_top_user
    return self.__aggregation_response_dynamic(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/deploy/intel_owl/api_app/views.py", line 945, in __aggregation_response_dynamic
    Job.objects.filter(**filter_kwargs)
  File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1590, in annotate
    return self._annotate(args, kwargs, select=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1638, in _annotate
    clone.query.add_annotation(
  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1132, in add_annotation
    self.check_alias(alias)
  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1125, in check_alias
    raise ValueError(
ValueError: Column aliases cannot contain whitespace characters, quotation marks, semicolons, or SQL comments.
@KaiseerKenopsia KaiseerKenopsia added the bug Something isn't working label Jan 9, 2025
@fgibertoni
Copy link
Contributor

Hi! Thank you for raising this.
Can you please share the username of your users that are causing the error?
I suspect there are some invalid characters in them.

@KaiseerKenopsia
Copy link
Author

I cannot share any specific names, but there are symbols used in czech alphabet ('ěščřžýáíéúůťďň') and dots('.')

@fgibertoni
Copy link
Contributor

fgibertoni commented Jan 10, 2025

I was not able to replicate the issue using the symbols that you provided.
We'll investigate deeper on the issue to find the root cause. In the meantime I hope everything else is operational on your side, this should not have impact on analysis.

@mlodic
Copy link
Member

mlodic commented Jan 27, 2025

any update on this?

As stated in the error log, that has been most probably caused to the presence of whitespaces in a name because there is no reference to either dots or language-specific characters.

This change appeared in this version most probably because of a security patch update introduced in Django and added to our new release.

In case we can confirm that the issue is related to what I suggested, we should add a validation clause to user creations to avoid whitespaces. Broadly speaking, that validation should be added anyway with the addition of filters for quotation marks and semicolons to avoid future errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants