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

Delete client cookie on introspection failure #385

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v24.20

### Pre-releases
- `v24.20-alpha6`
- `v24.20-alpha5`
- `v24.20-alpha4`
- `v24.20-alpha3`
Expand All @@ -13,6 +14,7 @@
- Default password criteria are more restrictive (#372, `v24.20-alpha1`, Compatible with Seacat Auth Webui v24.19-alpha and later, Seacat Account Webui v24.08-beta and later)

### Fix
- Delete client cookie on introspection failure (#385, `v24.20-alpha6`)
- Extend session expiration at cookie entrypoint (#383, `v24.20-alpha5`)
- Do not log failed LDAP login as error (#381, `v24.20-alpha4`)
- Properly handle Argon2 verification error in login call (#378, `v24.20-alpha3`)
Expand Down
4 changes: 2 additions & 2 deletions seacatauth/cookie/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async def nginx(self, request):
response = aiohttp.web.HTTPUnauthorized()

if response.status_code != 200:
self.CookieService.delete_session_cookie(response)
self.CookieService.delete_session_cookie(response, client_id)
return response

return response
Expand Down Expand Up @@ -263,7 +263,7 @@ async def nginx_anonymous(self, request):
cookie_domain = client.get("cookie_domain") or None

if response.status_code != 200:
self.CookieService.delete_session_cookie(response)
self.CookieService.delete_session_cookie(response, client_id)
return response

if anonymous_session_created:
Expand Down
6 changes: 4 additions & 2 deletions seacatauth/cookie/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import hashlib
import re
import logging
import typing

import asab
import asab.storage
Expand Down Expand Up @@ -296,8 +297,9 @@ def set_session_cookie(self, response, cookie_value, client_id=None, cookie_doma
)


def delete_session_cookie(self, response):
def delete_session_cookie(self, response, client_id: typing.Optional[str] = None):
"""
Add a Set-Cookie header to the response to unset Seacat Session cookie
"""
response.del_cookie(self.CookieName)
cookie_name = self.get_cookie_name(client_id)
response.del_cookie(cookie_name)
Loading