Skip to content

Commit

Permalink
RHBPMS-397 - Allow insecure Remote task operations (not only limited …
Browse files Browse the repository at this point in the history
…to GetTask* commands) (kiegroup#551)
  • Loading branch information
mrietveld authored and mswiderski committed Jul 28, 2016
1 parent 1328793 commit 67d7c0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected <T> T executeCommand( Command cmd ) {

void preprocessCommand( Command cmd ) {
String cmdName = cmd.getClass().getSimpleName();
if( ! config.getDisableTaskSecurity() && cmd instanceof TaskCommand && cmdName.startsWith("GetTask") ) {
if( ! config.getDisableTaskSecurity() && cmd instanceof TaskCommand ) {
TaskCommand taskCmd = (TaskCommand) cmd;
String cmdUserId = taskCmd.getUserId();
String authUserId = config.getUserName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ public static JaxbCommandsResponse restProcessJaxbCommandsRequest(JaxbCommandsRe
if( cmd instanceof TaskCommand ) {
String cmdName = cmd.getClass().getSimpleName();
if( ! allowAllUsersAccessToAllTasks ) {
if( cmdName.startsWith("GetTask") ) {
String cmdUserId = ((TaskCommand) cmd).getUserId();
if( cmdUserId == null ) {
throw KieRemoteRestOperationException.badRequest("A null user id for a '" + cmdName + "' is not allowed!");
}
String authUserId = identityProvider.getName();
if( ! cmdUserId.equals(authUserId) ) {
throw KieRemoteRestOperationException.conflict("The user id used when retrieving task information (" + cmdUserId + ")"
+ " must match the authenticating user (" + authUserId + ")!");
}
String cmdUserId = ((TaskCommand) cmd).getUserId();
if( cmdUserId == null ) {
throw KieRemoteRestOperationException.badRequest("A null user id for a '" + cmdName + "' is not allowed!");
}
String authUserId = identityProvider.getName();
if( ! cmdUserId.equals(authUserId) ) {
throw KieRemoteRestOperationException.conflict("The user id used when retrieving task information (" + cmdUserId + ")"
+ " must match the authenticating user (" + authUserId + ")!");
}
}
}
Expand Down

0 comments on commit 67d7c0f

Please sign in to comment.