spring-projects / spring-projects/spring-security
Problems with object_id_identity in table acl_object_identity
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
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🫙5.0.8.RELEASE
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with createAclSchemaPostgres.sql and BasicLookupStrategy.java around line 639, then trace the readAclById calls shown in the stack trace. Reproduce the issue with ObjectIdentityImpl for Card and identifier 42. Done means the sample createAcl call succeeds with the PostgreSQL schema and the identifier is handled consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, postgresql
- Domain
- databases, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100