camunda / camunda

Process Orchestration Framework
https://camunda.com/platform/
3.32k stars 604 forks source link

Update authorization implementation for Operate V1/internal endpoints #23352

Open houssain-barouni opened 3 weeks ago

houssain-barouni commented 3 weeks ago

Overview

Operate uses PermissionService to check permissions on process definitions and decision definitions. PermissionService uses Identity SDK for retrieving authorizations. In current implementation all authorizations are retrieved and then filtered by application logic.

From 8.7 on the Identity SDK is not available anymore. PermissionService needs to retrieve authorizations from AuthorizationService.

Retrieving a list of AuthorizationEntity can be done for example:

 final List<AuthorizationEntity> authorizationEntities =
        authorizationServices
            .search(
                AuthorizationQuery.of(
                    q ->
                        q.filter(
                            f ->
                                f.resourceKey(processDefinitionId)
                                    .resourceType(RESOURCE_TYPE_PROCESS_DEFINITION))))
            .items();

Components for permissions:

Proposal

Tasks

Adjust types and mapping of types:

The following queries needs to be rewritten:

Add missing checks:

romansmirnov commented 1 day ago

@ralfpuchert, just a few questions/notes:

With

Add permissions check in v1 API

Do I assume correctly that the @PreAuthorize("hasPermission(...)") is meant?

The following queries needs to be rewritten:

This refers to the `PermissionService, right?

https://github.com/camunda/camunda/blob/622f2cd835abe17412b0523941b3ef11d3819c53/operate/webapp/src/main/java/io/camunda/operate/webapp/security/identity/PermissionsService.java

... and by that, the permissions won't retrieved anymore from the session/authentication?

Additionally, to make sure, what about checking access to the Operate UI? Will this be covered by the Identity stream (@Ben-Sheppard)?