Skip to content

NPE when device representation cannot be parsed #33814

Closed
@rmartinc

Description

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

authentication

Describe the bug

The nightly tests for the old adapters returned this exception yesterday:

ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-2) Uncaught server error: java.lang.NullPointerException: Cannot invoke "org.keycloak.representations.account.DeviceRepresentation.getBrowser()" because "deviceRepresentation" is null
  	at org.keycloak.utils.SecureContextResolver.isSecureContext(SecureContextResolver.java:41)
  	at org.keycloak.utils.SecureContextResolver.isSecureContext(SecureContextResolver.java:32)
  	at org.keycloak.cookie.DefaultCookieProvider.<init>(DefaultCookieProvider.java:30)
 	at org.keycloak.cookie.DefaultCookieProviderFactory.create(DefaultCookieProviderFactory.java:11)
  	at org.keycloak.cookie.DefaultCookieProviderFactory.create(DefaultCookieProviderFactory.java:7)
  	at org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:178)
  	at org.keycloak.locale.DefaultLocaleUpdaterProvider.expireLocaleCookie(DefaultLocaleUpdaterProvider.java:68)
        ...

It was because of the changes in the secure context to fix the safari issue #33557. We have just to check for null in these lines.

Version

999

Regression

  • The issue is a regression

Expected behavior

No NPE and detect the secure context.

Actual behavior

NPE

How to Reproduce?

Don't send any header for the user agent.

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions