apache / apache/gravitino

[Improvement] Remove the JCasbin enforcer from the Gravitino authorizer

Open
#12,282 0 comments 0 reactions 0 assignees View on GitHub
improvement
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 17h
Merged PRs (30d)
339

Description

### What would you like to be improved?

After #12174 moves privilege policies from JCasbin `p` rules to a per-role policy index, the remaining enforcer only stores the user/group-to-role grouping graph.

This duplicates role membership already resolved from the version-validated user/group role caches. It also retains unnecessary shared mutable state, JCasbin model initialization, adapter code, resources, tests, and the JCasbin dependency in `server-common`.

### How should we improve?

Remove the enforcer from `JcasbinAuthorizer`:

- Compute the union of direct and group-inherited role IDs in `loadRolePrivilege`.
- Store the immutable effective role ID set in `AuthorizationRequestContext`.
- Resolve privilege effects and deny-policy checks against this request-scoped role set and the existing per-role `Map` index.
- Preserve global DENY precedence, active-role narrowing for ALLOW, OWNER handling, and role-version validation.
- Remove enforcer grouping-row binding and pruning.
- Remove the unused JCasbin adapter, model resources, model tests, and the JCasbin dependency from `server-common`.
- Add regression tests covering direct/group roles, role changes between requests, active roles, and DENY precedence.

The JCasbin dependency used independently by the Iceberg REST server is outside this change.

Related: #12173, #12174, #10908.

Contributor guide

Open the contributing guide

Research direction

Start in server-common at JcasbinAuthorizer, loadRolePrivilege, and AuthorizationRequestContext; trace how direct and group-inherited roles and the existing per-role policy index are used. Review the enforcer adapter, model resources, model tests, and regression-test area before running the relevant authorization tests. Done means the enforcer and its dependency are removed from server-common while role-version validation, active-role narrowing, OWNER handling, and global DENY precedence remain covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authorization, backend, security
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.