JDBC session store: InvalidClassException on SecurityContextImpl after Spring Security upgrade (similar to #181, but for SPRING_SESSION_ATTRIBUTES)

オープン
#4,189 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java, spring, sql

調査の方向性

Start with UaaJdbcSessionConfig and the SPRING_SESSION_ATTRIBUTES.ATTRIBUTE_BYTES serialization path, then compare the JSON-based UaaTokenStore approach from #181. Reproduce the rolling-upgrade failure with an existing JDBC session, and confirm that the session conversion service or serializer can read both SecurityContextImpl versions. Done means old and new sessions remain usable across the upgrade and a regression test covers both serialization directions.

索引モデルが issue の本文から書いたものです。

説明

With servlet.session-store: database, sessions are stored by Spring Session JDBC using JDK serialization. After upgrading UAA to a version with a different Spring Security minor, any request carrying an existing JSESSIONID fails:

  at org.springframework.session.jdbc.JdbcIndexedSessionRepository.deserialize
  at ...JdbcSession.getAttribute
  at ...HttpSessionSecurityContextRepository.loadContext
Caused by: java.io.InvalidClassException: org.springframework.security.core.context.SecurityContextImpl;
  local class incompatible: stream classdesc serialVersionUID = 580, local class serialVersionUID = 620

The same happens in both directions during a rolling update. The Thymeleaf error template also reads the session, so the error page fails to render too (TemplateOutputException).

#181 fixed this for oauth_code by storing JSON (UaaTokenStore). SPRING_SESSION_ATTRIBUTES.ATTRIBUTE_BYTES has the same problem. UaaJdbcSessionConfig does not configure a springSessionConversionService or any serializer.

UAA Version - 78.9.0

Full log -

org.thymeleaf.exceptions.TemplateOutputException: An error happened during template rendering
	...
Caused by: org.springframework.core.convert.ConversionFailedException: Failed to convert from type [byte[]] to type [java.lang.Object] for value [{...}]
	...
	at org.springframework.session.jdbc.JdbcIndexedSessionRepository.deserialize(JdbcIndexedSessionRepository.java:689)
	at org.springframework.session.jdbc.JdbcIndexedSessionRepository$JdbcSession.getAttribute(JdbcIndexedSessionRepository.java:801)
	at org.springframework.session.web.http.HttpSessionAdapter.getAttribute(HttpSessionAdapter.java:102)
	at org.springframework.security.web.context.HttpSessionSecurityContextRepository.readSecurityContextFromSession(HttpSessionSecurityContextRepository.java:212)
	at org.springframework.security.web.context.HttpSessionSecurityContextRepository.loadContext(HttpSessionSecurityContextRepository.java:126)
	...
Caused by: org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?
	...
Caused by: java.io.InvalidClassException: org.springframework.security.core.context.SecurityContextImpl; local class incompatible: stream classdesc serialVersionUID = 580, local class serialVersionUID = 620```
主要言語
Java
スター
1.6k
フォーク
847
平均マージ
2日 1時間
マージ済み PR(30日)
48

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cloudfoundry/uaa のほかの issue

cloudfoundry/uaa の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。