Actions
Bug #7781
closedIdentity error on /static/*
Start date:
09/13/2024
Due date:
% Done:
0%
Estimated time:
To be discussed:
No
Description
Message type: CRITICAL
Location: /var/mentat/venv/lib/python3.11/site-packages/hawat/base.py:203
Module: base
Function: eh_internal_server_error
Time: 2024-09-13 14:58:20,191
Message:
INTERNAL SERVER ERROR
Request: /static/css/?
Traceback:
Traceback (most recent call last):
File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1669, in handle_user_exception
return self.handle_http_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1609, in handle_http_exception
return self.ensure_sync(handler)(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/base.py", line 518, in eh_page_not_found
return hawat.errors.error_handler_switch(404, err)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/errors.py", line 48, in error_handler_switch
return error_response(status_code, exception=exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/errors.py", line 99, in error_response
render_template(
File "/var/mentat/venv/lib/python3.11/site-packages/flask/templating.py", line 147, in render_template
return _render(app, template, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/flask/templating.py", line 130, in _render
rv = template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/var/mentat/venv/lib/python3.11/site-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/blueprints/design_bs3/templates/http_error.html", line 2, in top-level template code
{%- import '_macros_errors.html' as macros_errors with context -%}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/blueprints/design_bs3/templates/_layout.html", line 99, in top-level template code
{%- block body %}
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/blueprints/design_bs3/templates/_layout.html", line 123, in block 'body'
{{ macros_site.render_submenu_auth() }}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/jinja2/runtime.py", line 782, in _invoke
rv = self._func(*arguments)
^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/blueprints/design_bs3/templates/_macros_site.html", line 89, in template
{%- for menu_item in hawat_current_menu_auth.get_entries() recursive %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/menu.py", line 551, in get_entries
return _get_menu_entries(self._entries, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/menu.py", line 144, in _get_menu_entries
_filter_menu_entries(entries, **kwargs).values()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/menu.py", line 109, in _filter_menu_entries
if not _filter_menu_entries(entry._entries, **kwargs): # pylint: disable=locally-disabled,protected-access
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/menu.py", line 117, in _filter_menu_entries
if not entry.view.authorize_item_action(**params):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/hawat/blueprints/groups/__init__.py", line 227, in authorize_item_action
return hawat.acl.PERMISSION_POWER.can() or permission_mm.can()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/flask_principal.py", line 347, in can
return self.require().can()
^^^^^^^^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/flask_principal.py", line 193, in can
return self.identity.can(self.permission)
^^^^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/flask_principal.py", line 188, in identity
return g.identity
^^^^^^^^^^
File "/var/mentat/venv/lib/python3.11/site-packages/flask/ctx.py", line 52, in __getattr__
raise AttributeError(name) from None
AttributeError: identity
Related issues
Updated by Rajmund Hruška about 2 months ago
- Related to Bug #6481: AttributeError: '_AppCtxGlobals' object has no attribute 'identity' added
Updated by Rajmund Hruška about 2 months ago
It seems the error only occurs when the user is authenticated.
Updated by Rajmund Hruška about 2 months ago
- Status changed from New to Feedback
- Assignee set to Rajmund Hruška
- Target version changed from Backlog to 2.14
I believe an easy fix would be to allow flask principal on static
endpoints, as mentioned in #6481#note-1. Regarding #6481#note-3, the files are public by default, no special handling of permissions is required.
Updated by Rajmund Hruška about 1 month ago
- Status changed from Feedback to In Review
Actions