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

Security issue: Row-level Predicate Policy avoids restrictions of Create action #3309

Closed
vfadeevGit opened this issue May 29, 2024 · 1 comment
Labels
state: invalid This doesn't seem right type: bug Something isn't working

Comments

@vfadeevGit
Copy link

Environment

Jmix version: <2.2.2>

Bug Description

After implementing Row-level role predicate policy for a dedicated Entity which avoids all actions (Create, Read, Update, Delete) for the user, who has got all Resource-level permissions on the same Entity -> Jmix blocks all buttons in runtime except Create.

Steps To Reproduce

  1. Create a Resource-level with all permissions for the Entity
  2. Create a Row-level Predicate Policy avoiding all actions for the same Entity like the following:
@RowLevelRole(name = "TankRestriction", code = TankRestrictionRole.CODE)
public interface TankRestrictionRole {
    String CODE = "tank-restriction";

    @PredicateRowLevelPolicy(entityClass = Tank.class, 
            actions = {RowLevelPolicyAction.READ, RowLevelPolicyAction.CREATE, RowLevelPolicyAction.UPDATE, RowLevelPolicyAction.DELETE})
    default RowLevelBiPredicate<Tank, ApplicationContext> tankPredicate() {
        return (tank, applicationContext) -> {
            return false;
        };
    }
}
  1. Assign both roles in runtime for some user
  2. Login under this user and open the list view of the Entity
  3. All buttons will be disabled except Create

Expected Behavior

All buttons should be blocked

@vfadeevGit vfadeevGit added triage Issue is waiting for triage type: bug Something isn't working labels May 29, 2024
@gorbunkov gorbunkov closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2024
@gorbunkov gorbunkov added state: invalid This doesn't seem right and removed triage Issue is waiting for triage labels May 31, 2024
@glebfox
Copy link
Contributor

glebfox commented May 31, 2024

RowLevelPolicyAction.CREATE cannot be applied to CreateAction because it creates a new entity and opens it in a detail view, i.e. there is nothing to check yet. In other words RowLevelPolicyAction.CREATE checks commit attempt instead of creating a new Java instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: invalid This doesn't seem right type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants