Skip to content
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

Inconsistent Paging for GET /shell-descriptors with Large Datasets and Classic Access Control #498

Open
efiege opened this issue Feb 25, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@efiege
Copy link

efiege commented Feb 25, 2025

Current Behavior

The GET /shell-descriptors endpoint returns a reduced amount of result entries for counter party BPNs when using the "Access Control Classic Implementation" with a large amount of ShellDescriptor entries.

Expected Behavior

The GET /shell-descriptors endpoint will return records that are accessible for the counter party BPN and an entry amount according to the page size.

Steps To Reproduce

  • Create a "large" amount of shell-descriptors, most probably larger then defined by the granularAccessControlFetchSize property
    • specify specificAssetIds with externalSubjectId set to {{COUNTER_PARTY_BPN}}
  • Fetch the GET /shell-descriptors endpoint with Edc-Bpn Header set to {{COUNTER_PARTY_BPN}}
  • Receive reduced amount of shell-descriptor records

Suspected Root Cause

The issue could recide in

private Predicate getAllShellsPredicate( Root<T> root, CriteriaQuery<?> cq, CriteriaBuilder criteriaBuilder, Instant searchValue ) {
// Join Shell -> ShellIdentifier
String t = Shell.Fields.identifiers;
Join<Shell,ShellIdentifier > shellIdentifierShellJoin = root.join( Shell.Fields.identifiers );
// join ShellIdentifier -> ShellIdentifierExternalSubjectReference -> ShellIdentifierExternalSubjectReferenceKey
Join<ShellIdentifierExternalSubjectReference,ShellIdentifierExternalSubjectReferenceKey> referenceKeyJoin = shellIdentifierShellJoin.join( ShellIdentifier.Fields.externalSubjectId ).join( ShellIdentifierExternalSubjectReference.Fields.keys );
return criteriaBuilder.and(
criteriaBuilder.or(
criteriaBuilder.equal( referenceKeyJoin.get( ShellIdentifierExternalSubjectReferenceKey.Fields.value ), tenantId ),
criteriaBuilder.and(
criteriaBuilder.equal( referenceKeyJoin.get( ShellIdentifierExternalSubjectReferenceKey.Fields.value ), publicWildcardPrefix ),
criteriaBuilder.in( shellIdentifierShellJoin.get( ShellIdentifier.Fields.key ) ).value( publicWildcardAllowedTypes )
)
),
criteriaBuilder.greaterThan( root.get( sortFieldName ), searchValue )
);
}

which creates joins that lead to multiple rows being generated per shell, which could confuse the paging mechanism of spring. The relevant call should come from

Page<Shell> currentPage = shellRepository.findAll( specification, ofSize( granularAccessControlFetchSize ) );

@efiege efiege added the bug Something isn't working label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant