Skip to content

Object ID Identity conversion to long fails on old schema #7621

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

Closed
nucatus opened this issue Nov 5, 2019 · 5 comments
Closed

Object ID Identity conversion to long fails on old schema #7621

nucatus opened this issue Nov 5, 2019 · 5 comments
Assignees
Labels
in: acl An issue in spring-security-acl status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@nucatus
Copy link

nucatus commented Nov 5, 2019

Summary

In case of an old ACL schema where the object_id_identity is of type bigint instead of the current varchar(36), the conversion of the identity to a known type fails.

Actual Behavior

Conversion of ACL object ID identity fails.

Expected Behavior

Conversion of the ACL object ID identity should succeed to a known type, or long if no class_id_type is provided.

Configuration

Version

5.2.x

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 5, 2019
@rwinch rwinch added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 5, 2019
@rwinch rwinch self-assigned this Nov 5, 2019
@rwinch rwinch added the in: acl An issue in spring-security-acl label Nov 5, 2019
@rwinch
Copy link
Member

rwinch commented Nov 5, 2019

Thanks for the report. Can you provide a sample of that reproduces this issue?

@nucatus
Copy link
Author

nucatus commented Nov 5, 2019

Well, I was just looking at the history of the aclSchema and noticed that the type of the object_id_identity field changed from BIGINT NOT NULL to VARCHAR(36) NOT NULL when support for non-Long IDs was added.

In our project we have a schema where the type is BIGINT UNSIGNED NOT NULL. When data is extracted from the ResultSet, the mysql driver will convert this type to a BigInteger. In the previous version, this was not an issue, because the conversion to Long was carried on the else branch of the hasConversionService(). This changed with this update, where this check is buggy, because canConvertFromStringTo(Long.class) will always return true, no matter the source type, and it's passing the call to the convertService.

Indeed, this works with the original schema, but in our case, where our schema is slightly different and the type that the mysql driver returns is a BigInteger, it fails because it is looking to convert it with the conversionService, instead of falling on the else branch where the conversation works for other, unknown, types.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 5, 2019
@rwinch rwinch added status: ideal-for-contribution An issue that we actively are looking for someone to help us with and removed status: feedback-provided Feedback has been provided labels Nov 6, 2019
@rwinch rwinch added this to the General Backlog milestone Nov 6, 2019
@rwinch rwinch removed their assignment Nov 6, 2019
@igorpele
Copy link
Contributor

Hi, I would like to work on this. As far as I understand, it only has to be verified that the conversion from String to Long is executed only if the identifier is an instance of String.

@dadikovi
Copy link
Contributor

@igorpele do you still want to work on this issue? (I'm just asking because I'm looking for an issue to work, but I can find other one off course)

@igorpele
Copy link
Contributor

@dadikovi as I got no response on this issue, you are welcome to take it.

dadikovi added a commit to dadikovi/spring-security that referenced this issue May 16, 2020
This change fixed a bug which tried to convert non-string object as string

Fixes spring-projectsgh-7621
@rwinch rwinch assigned dadikovi and rwinch and unassigned dadikovi May 19, 2020
@rwinch rwinch added type: bug A general bug and removed status: ideal-for-contribution An issue that we actively are looking for someone to help us with labels May 19, 2020
@rwinch rwinch modified the milestones: General Backlog, 5.4.0-M2 May 19, 2020
@rwinch rwinch closed this as completed in 4ab9da1 May 19, 2020
rwinch pushed a commit that referenced this issue May 19, 2020
This change fixed a bug which tried to convert non-string object as string

Fixes gh-7621
@spring-projects-issues spring-projects-issues added the status: backported An issue that has been backported to maintenance branches label May 19, 2020
rwinch pushed a commit that referenced this issue May 19, 2020
This change fixed a bug which tried to convert non-string object as string

Fixes gh-7621
@jzheaux jzheaux changed the title Object ID Identicy conversion to long fails on old schema Object ID Identity conversion to long fails on old schema May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: acl An issue in spring-security-acl status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants