-
Notifications
You must be signed in to change notification settings - Fork 6
[bug-fix] Permission revoked approver can still perform workflow approval tasks #27
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
[bug-fix] Permission revoked approver can still perform workflow approval tasks #27
Conversation
...ain/java/org/wso2/carbon/identity/workflow/engine/internal/dao/impl/ApprovalTaskDAOImpl.java
Show resolved
Hide resolved
...ine/src/main/java/org/wso2/carbon/identity/workflow/engine/util/WorkflowEngineConstants.java
Outdated
Show resolved
Hide resolved
...gine/src/main/java/org/wso2/carbon/identity/workflow/engine/dto/ApprovalTaskRelationDTO.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where permission-revoked approvers could still perform workflow approval tasks. The solution implements automatic updates to pending approval tasks when workflows are modified, ensuring that only eligible approvers can continue with approval processes.
- Updates pending approval task structures when workflow configurations change
- Validates existing reserved tasks against new approval configurations
- Adds utility methods for comparing approval steps and parameter changes
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| WorkflowEngineConstants.java | Adds new SQL queries and reorganizes error codes with better categorization |
| Utils.java | New utility class with methods for processing approval step parameters and detecting modifications |
| ApprovalTaskDAOImpl.java | Implements new database methods for retrieving pending requests and approval task relations |
| ApprovalTaskDAO.java | Adds interface methods for pending request and approval task relation queries |
| ApprovalTaskRelationDTO.java | New DTO class for representing approval task data from database relations |
| DefaultTemplateInitializer.java | Removes unused role creation logic |
| ApprovalTaskServiceImpl.java | Core logic for updating approval tasks when workflows change |
| ApprovalTaskService.java | Interface method for workflow update handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...ntity.workflow.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/util/Utils.java
Outdated
Show resolved
Hide resolved
...ain/java/org/wso2/carbon/identity/workflow/engine/internal/dao/impl/ApprovalTaskDAOImpl.java
Outdated
Show resolved
Hide resolved
...w.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/ApprovalTaskServiceImpl.java
Outdated
Show resolved
Hide resolved
...w.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/ApprovalTaskServiceImpl.java
Outdated
Show resolved
Hide resolved
...w.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/ApprovalTaskServiceImpl.java
Outdated
Show resolved
Hide resolved
...ain/java/org/wso2/carbon/identity/workflow/engine/internal/dao/impl/ApprovalTaskDAOImpl.java
Outdated
Show resolved
Hide resolved
...ain/java/org/wso2/carbon/identity/workflow/engine/internal/dao/impl/ApprovalTaskDAOImpl.java
Show resolved
Hide resolved
...ntity.workflow.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/util/Utils.java
Outdated
Show resolved
Hide resolved
...ntity.workflow.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/util/Utils.java
Show resolved
Hide resolved
...ntity.workflow.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/util/Utils.java
Outdated
Show resolved
Hide resolved
...ntity.workflow.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/util/Utils.java
Outdated
Show resolved
Hide resolved
...ine/src/main/java/org/wso2/carbon/identity/workflow/engine/util/WorkflowEngineConstants.java
Outdated
Show resolved
Hide resolved
...w.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/ApprovalTaskServiceImpl.java
Outdated
Show resolved
Hide resolved
...w.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/ApprovalTaskServiceImpl.java
Outdated
Show resolved
Hide resolved
...w.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/ApprovalTaskServiceImpl.java
Outdated
Show resolved
Hide resolved
|
PR builder started |
...ntity.workflow.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/util/Utils.java
Show resolved
Hide resolved
...kflow.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/ApprovalTaskService.java
Outdated
Show resolved
Hide resolved
...kflow.engine/src/main/java/org/wso2/carbon/identity/workflow/engine/ApprovalTaskService.java
Outdated
Show resolved
Hide resolved
...ain/java/org/wso2/carbon/identity/workflow/engine/internal/dao/impl/ApprovalTaskDAOImpl.java
Outdated
Show resolved
Hide resolved
|
PR builder completed |
jenkins-is-staging
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/17393884142
…release v1.0.13
…for next development iteration
| } catch (DataAccessException e) { | ||
| String errorMessage = String.format("Error occurred while retrieving approval tasks for the " + | ||
| "workflow id: %s", workflowId); | ||
| log.debug(errorMessage, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about wrapping this with a log.isDebugEnabled() check to avoid unnecessary string formatting when debug logging is disabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In here we are passing the error message when throwing the error anyway. So we can skip the debug check.
| } catch (DataAccessException e) { | ||
| String errorMessage = String.format("Error occurred while retrieving approval task relations for the " + | ||
| "request id: %s", requestId); | ||
| log.debug(errorMessage, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about wrapping this with a log.isDebugEnabled() check to avoid unnecessary string formatting when debug logging is disabled?
Purpose
Update pending approval task corresponding to the workflow, when the flow is updated.
Approach
For each
pendingstate request under the changed workflow, check whether the workflow changes have affected the current state of the request. If affected:READYstate requests are removed and recreated according to new workflow configs.RESERVED/BLOCKEDstate requests are checked for the eligibility to have the same state under the new configs. And if yes; a new set of tasks withRESERVED/BLOCKEDis created or else a newREADYstate is created.Related Issues
Related PRs
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning