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

Unhandled exception in case of malformed session cookie (server returns 500 Internal Server Error) #1760

Open
mancze opened this issue Aug 1, 2024 · 0 comments

Comments

@mancze
Copy link
Contributor

mancze commented Aug 1, 2024

Expected Behavior

Micronaut server should not return 500 Internal Server Error in case of malformed session cookie in the request. It is incorrectly formatted request which should be categorized as 4xx.

Actual Behaviour

Response 500 Internal Server Error is sent because of the unhandled exception:

Unexpected error occurred: Illegal base64 character 5f
java.lang.IllegalArgumentException: Illegal base64 character 5f
	at java.base/java.util.Base64$Decoder.decode0(Base64.java:847)
	at java.base/java.util.Base64$Decoder.decode(Base64.java:566)
	at java.base/java.util.Base64$Decoder.decode(Base64.java:589)
	at io.micronaut.session.http.CookieHttpSessionIdGenerator.sessionIdFromCookie(CookieHttpSessionIdGenerator.java:77)
	at io.micronaut.session.http.CookieHttpSessionStrategy.resolveIds(CookieHttpSessionStrategy.java:78)
	at io.micronaut.session.http.HttpSessionFilter.doFilter(HttpSessionFilter.java:85)
	at io.micronaut.http.filter.HttpServerFilter.doFilter(HttpServerFilter.java:48)

Steps To Reproduce

  • Run ApplicationTest in the example application

Environment Information

No response

Example Application

mancze/micronaut-sandbox@9980567

Version

4.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant