Skip to content

RoleHierarchy Comments are misleading #6954

Closed
@since1986

Description

@since1986

Summary

In the current version (5.1.5), the comments in the org.springframework.security.access.hierarchicalroles.RoleHierarchy class do not indicate their true behavior and are misleading.

Actual Behavior

The correct expression for "role inheritance" should be defined like this: "ROLE_HIGHEST > ROLE_HIGHER > ROLE_LOW > ROLE_LOWER > ROLE_LOWEST".

Expected Behavior

But the comment says it needs to be defined like this: "ROLE_HIGHEST > ROLE_HIGHER and ROLE_HIGHER > ROLE_LOW and ROLE_LOW > ROLE_LOWER and ROLE_LOWER > ROLE_LOWEST". This way of defining expressions is fine in earlier versions, but it is wrong in the current version (I learned from debugging source code).

Configuration

Version

5.1.5

Sample

Please focus on two places:
org.springframework.security.access.hierarchicalroles.RoleHierarchyImpl#buildRolesReachableInOneStepMap
org.springframework.security.access.expression.SecurityExpressionRoot#hasAnyAuthorityName

Metadata

Metadata

Assignees

Labels

in: docsAn issue in Documentation or samplestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions