Conversation
Copilot
AI
changed the title
[WIP] Fix ActiveSupport::MessagePack::UnserializableObjectError at login
Convert Net::BER::BerIdentifiedString to String for Rails 8.0 MessagePack compatibility
Dec 10, 2025
Owner
|
@copilot Can you fix the frontend and backend tests too? Currently getting the error: |
Contributor
Author
Fixed in commit 377a9c2. Updated all GitHub Actions workflows to use non-deprecated versions:
The CI workflows should now run without deprecation errors. |
Owner
|
@copilot Getting closer. Now getting the error: |
Contributor
Author
... Fixed in commit 46e5473. The issue was caused by the deprecated
The Yarn cache action should now receive the proper path value. |
Convert Net::BER::BerIdentifiedString objects to regular Ruby strings in the map_user method to prevent ActiveSupport::MessagePack::UnserializableObjectError when authenticating new LDAP users with Discourse 3.6.0.beta2+ Co-authored-by: jonmbake <[email protected]>
Updated to use &.to_s instead of .to_s to preserve original behavior when LDAP attributes are empty or missing. This maintains backward compatibility while fixing the BerIdentifiedString serialization issue. Co-authored-by: jonmbake <[email protected]>
46e5473 to
50ba81c
Compare
jonmbake
approved these changes
Dec 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix ActiveSupport::MessagePack::UnserializableObjectError in LDAP Authentication
This PR addresses the issue where new users cannot log in after upgrading Discourse from 3.6.0.beta1 to 3.6.0.beta2.
Root Cause
Rails 8.0 (used in Discourse 3.6.0.beta2) introduced MessagePack as the default serializer, which cannot serialize
Net::BER::BerIdentifiedStringobjects returned by the net-ldap gem.Solution
Modified the
map_usermethod inlib/omniauth/strategies/ldap.rbto convert allNet::BER::BerIdentifiedStringobjects to regular Ruby strings using the safe navigation operator (&.to_s).Changes Made
&.to_sfor String mapper case&.to_sfor Array mapper case&.to_sfor Hash mapper case::set-outputcommands with$GITHUB_OUTPUTenvironment fileThe safe navigation operator ensures backward compatibility by preserving nil behavior when LDAP attributes are empty or missing.
Testing & Validation
map_usermethod to convert LDAP values to stringsSecurity Summary
✓ CodeQL scan completed with 0 vulnerabilities found
This is a minimal, surgical fix that solves the serialization issue while maintaining full backward compatibility.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.