Skip to content

False positive in avoid-unpaginated-repository-access.ql when a project defines its own Repository type #39

Description

@olegoaer

Bug report

The query codeql-custom-queries-java/spring/avoid-unpaginated-repository-access.ql may produce a false positive because it matches any supertype named Repository:

call.getQualifier().getType().(RefType).getASupertype*().getName() = "Repository"

This only checks the simple type name, not whether the type actually belongs to Spring Data.

If a project defines its own Repository interface/class, unrelated to Spring, the query may still flag findAll() calls in a Spring endpoint as if they were Spring repository accesses.

Expected behavior

Only Spring Data repository types should be matched.

Suggested fix

Use fully qualified type matching, or otherwise restrict the detection to known Spring repository interfaces (org.springframework.stereotype.Repository)

Metadata

Metadata

Assignees

No one assigned

    Labels

    💉 bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions