Skip to content
Snippets Groups Projects
Unverified Commit 1383508f authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

Handle an empty cookie as an invalid macaroon. (#9620)

* Handle an empty cookie as an invalid macaroon.

* Newsfragment
parent dd69110d
No related branches found
No related tags found
No related merge requests found
Fix a bug introduced in v1.28.0 where the OpenID Connect callback endpoint could error with a `MacaroonInitException`.
...@@ -29,6 +29,7 @@ from authlib.oidc.discovery import OpenIDProviderMetadata, get_well_known_url ...@@ -29,6 +29,7 @@ from authlib.oidc.discovery import OpenIDProviderMetadata, get_well_known_url
from jinja2 import Environment, Template from jinja2 import Environment, Template
from pymacaroons.exceptions import ( from pymacaroons.exceptions import (
MacaroonDeserializationException, MacaroonDeserializationException,
MacaroonInitException,
MacaroonInvalidSignatureException, MacaroonInvalidSignatureException,
) )
from typing_extensions import TypedDict from typing_extensions import TypedDict
...@@ -217,7 +218,7 @@ class OidcHandler: ...@@ -217,7 +218,7 @@ class OidcHandler:
session_data = self._token_generator.verify_oidc_session_token( session_data = self._token_generator.verify_oidc_session_token(
session, state session, state
) )
except (MacaroonDeserializationException, KeyError) as e: except (MacaroonInitException, MacaroonDeserializationException, KeyError) as e:
logger.exception("Invalid session for OIDC callback") logger.exception("Invalid session for OIDC callback")
self._sso_handler.render_error(request, "invalid_session", str(e)) self._sso_handler.render_error(request, "invalid_session", str(e))
return return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment