Skip to content

Problems with object_id_identity in table acl_object_identity #5909

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

Open
akoshman opened this issue Sep 28, 2018 · 1 comment
Open

Problems with object_id_identity in table acl_object_identity #5909

akoshman opened this issue Sep 28, 2018 · 1 comment
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@akoshman
Copy link

Summary

In the Spring ACL database schema for PostgreSQL (specified in createAclSchemaPostgres.sql) definition for table acl_object_identity look like this:

create table acl_object_identity(
    id bigserial primary key,
    object_id_class bigint not null,
    object_id_identity varchar(36) not null,
    parent_object bigint,
    owner_sid bigint,
    entries_inheriting boolean not null,
    -- constraints are omitted for brevity
);

So, column object_id_identity is of text type.

Actual Behavior

When I execute this piece of code

ObjectIdentity identity = new ObjectIdentityImpl("com.example.data.model.Card", "42");
MutableAcl acl = mutableAclService.createAcl(identity);

I get an exception telling me there is a problem with finding object identity:


org.springframework.security.acls.model.NotFoundException: Unable to find ACL information for object identity 'org.springframework.security.acls.domain.ObjectIdentityImpl[Type: com.example.data.model.Card; Identifier: 42]'
	at org.springframework.security.acls.jdbc.JdbcAclService.readAclsById(JdbcAclService.java:136) ~[spring-security-acl-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.security.acls.jdbc.JdbcAclService.readAclById(JdbcAclService.java:112) ~[spring-security-acl-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.security.acls.jdbc.JdbcAclService.readAclById(JdbcAclService.java:120) ~[spring-security-acl-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.security.acls.jdbc.JdbcMutableAclService.createAcl(JdbcMutableAclService.java:122) ~[spring-security-acl-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at com.example.security.acl.AclModelService.create(AclModelService.java:22) ~[classes/:na]

Basically, there is a problem with resolving type of column object_id_identity in
BasicLookupStrategy:639
While actually being String type, identifier is treated as of type Long. Later in code it leads to the aforementioned exception.
I guess this check it totally pointless since the type of object_id_identity is text.

Expected Behavior

Such piece of code must execute correctly

ObjectIdentity identity = new ObjectIdentityImpl("com.example.data.model.Card", "42");
MutableAcl acl = mutableAclService.createAcl(identity);

Configuration

Standard configuration with schema provided in createAclSchemaPostgres.sql

Version

org.springframework.security:spring-security-acl:jar:5.0.8.RELEASE

@maxploter
Copy link
Contributor

Probably it's more correct to use Long instead of String as identifier of ObjectIdentityImpl.

ObjectIdentity identity = new ObjectIdentityImpl("com.example.data.model.Card", 42L);
MutableAcl acl = mutableAclService.createAcl(identity);

Later on the identifier would be converted to String before database insertion.

protected void createObjectIdentity(ObjectIdentity object, Sid owner) {
		Long sidId = createOrRetrieveSidPrimaryKey(owner, true);
		Long classId = createOrRetrieveClassPrimaryKey(object.getType(), true, object.getIdentifier().getClass());
		jdbcOperations.update(insertObjectIdentity, classId, object.getIdentifier().toString(), sidId,
				Boolean.TRUE);

It was an issue with conversion from Long to String before insertion but it is solved within 5508. Probably current issue could be closed.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants