Skip to content

Fix jdbc session with special characters #3316

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

Conversation

mindhaq
Copy link
Contributor

@mindhaq mindhaq commented Jan 7, 2025

This fixes #3299, which prevents having session attributes with special characters to be stored in a JSONB column as JSON by using a different insertion method for the JSON blob stream.

See also the documentation of convert_from method.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 7, 2025
@rwinch rwinch closed this Jan 8, 2025
@rwinch rwinch reopened this Jan 8, 2025
@rwinch rwinch closed this Apr 22, 2025
@rwinch rwinch reopened this Apr 22, 2025
@rwinch rwinch force-pushed the 3299-fix-jdbc-session-special-characters-problem branch 4 times, most recently from 6e483b8 to 96f45d9 Compare April 22, 2025 17:15
mindhaq and others added 3 commits April 22, 2025 13:42

Verified

This commit was signed with the committer’s verified signature.
rwinch Rob Winch
…ains a special character

Verified

This commit was signed with the committer’s verified signature.
rwinch Rob Winch
… encode() to insert JSON byte stream into PreparedStatement.

This works with session attributes containing special characters in the JSON blob.

Verified

This commit was signed with the committer’s verified signature.
rwinch Rob Winch
Signed-off-by: Rob Winch <362503+rwinch@users.noreply.github.com>
@rwinch rwinch force-pushed the 3299-fix-jdbc-session-special-characters-problem branch from 96f45d9 to 3a3d958 Compare April 22, 2025 18:43
@rwinch rwinch self-assigned this Apr 22, 2025
@rwinch rwinch added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 22, 2025
@rwinch rwinch added this to the 3.5.0-RC1 milestone Apr 22, 2025
@rwinch rwinch merged commit 6fd52ca into spring-projects:main Apr 22, 2025
4 checks passed
@rwinch
Copy link
Member

rwinch commented Apr 22, 2025

Thanks for the Pull Request! This is now merged into main 😄

I did extract out the test for the username with special characters out so that it does not impact the sample application for users trying to log in (we want a consistent username/password for those)

@rwinch rwinch changed the title #3299 fix jdbc session special characters problem Fix jdbc session with special characters Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spring Session JDBC JSON format invalid escape sequence
3 participants