view libervia/web/pages/login/logged/page_meta.py @ 1598:86c7a3a625d5

server: always start a new session on connection: The session was kept when a user was connecting from service profile (but not from other profiles), this was leading to session fixation vulnerability (an attacker on the same machine could get service profile session cookie, and use it when a victim would log-in). This patch fixes it by always starting a new session on connection. fix 443
author Goffi <goffi@goffi.org>
date Fri, 23 Feb 2024 13:35:24 +0100
parents 7941444c1671
children
line wrap: on
line source

#!/usr/bin/env python3


from libervia.web.server import session_iface
from libervia.backend.core.log import getLogger

log = getLogger(__name__)

"""Libervia Web log-in page, with link to create an account"""

template = "login/logged.html"


def prepare_render(self, request):
    template_data = request.template_data
    session_data = self.host.get_session_data(request, session_iface.IWebSession)
    template_data["guest_session"] = session_data.guest
    template_data["session_started"] = session_data.started