Skip to content

Commit 5a87d32

Browse files
mcgilmanpvillard31
authored andcommitted
NIFI-15265: Fixing bug where the getLocalConnectable was being used to authorize access to a RemoteProcessGroup. Instead we need to use getRemoteProcessGroup from the authorizable lookup.
Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes #10566.
1 parent e3906fb commit 5a87d32

File tree

1 file changed

+11
-2
lines changed
  • nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api

1 file changed

+11
-2
lines changed

nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,13 @@ public Response clearBulletins(
12951295
throw new IllegalArgumentException("The from timestamp must be specified.");
12961296
}
12971297

1298+
// Collect RPG IDs to distinguish them from local connectables during authorization
1299+
final Set<String> remoteProcessGroupIds = serviceFacade.filterComponents(id, group ->
1300+
group.findAllRemoteProcessGroups().stream()
1301+
.map(rpg -> rpg.getIdentifier())
1302+
.collect(Collectors.toSet())
1303+
);
1304+
12981305
// if the components are not specified, gather all authorized components
12991306
if (clearBulletinsForGroupRequestEntity.getComponents() == null) {
13001307
// get component IDs that the user has write access to
@@ -1344,8 +1351,10 @@ public Response clearBulletins(
13441351
// ensure access to every component being cleared
13451352
final Set<String> requestComponentsToClear = clearBulletinsForGroupRequestEntity.getComponents();
13461353
requestComponentsToClear.forEach(componentId -> {
1347-
final Authorizable connectable = lookup.getLocalConnectable(componentId);
1348-
connectable.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser());
1354+
final Authorizable authorizable = remoteProcessGroupIds.contains(componentId)
1355+
? lookup.getRemoteProcessGroup(componentId)
1356+
: lookup.getLocalConnectable(componentId);
1357+
authorizable.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser());
13491358
});
13501359
},
13511360
() -> { },

0 commit comments

Comments
 (0)