Skip to content

[Fix-18211][API] Add missing project authorization on view-gantt/view-variables and trigger workflow APIs#18212

Merged
ruanwenjun merged 1 commit into
apache:devfrom
ruanwenjun:dev_wenjun_fixCvePermissionCheck
May 3, 2026
Merged

[Fix-18211][API] Add missing project authorization on view-gantt/view-variables and trigger workflow APIs#18212
ruanwenjun merged 1 commit into
apache:devfrom
ruanwenjun:dev_wenjun_fixCvePermissionCheck

Conversation

@ruanwenjun
Copy link
Copy Markdown
Member

Was this PR generated or assisted by AI?

YES, ops 4.7

Purpose of the pull request

close #18211

The view-gantt / view-variables endpoints on WorkflowInstanceController and the start-workflow-instance / batch-start-workflow-instance endpoints on ExecutorController did not verify that the login user had permission on the URL projectCode, allowing any authenticated user to read another project's workflow instance details or trigger another project's online workflows.

  • WorkflowInstanceServiceImpl#viewVariables/viewGantt now require loginUser and check projectService.checkProjectAndAuth with WORKFLOW_INSTANCE before reading the instance.
  • WorkflowTriggerRequest / WorkflowBackFillRequest carry the URL projectCode. ExecutorServiceImpl#triggerWorkflowDefinition / backfillWorkflowDefinition gate the call with checkProjectAndAuthThrowException(RERUN) and reject when the resolved workflowDefinition does not belong to that projectCode.
  • ExecutorController and PythonGateway propagate projectCode into the request builders. batchTriggerWorkflowDefinitions also accepts the path variable so the inner per-code call inherits it.
  • New ExecutorServiceTest covers the unauthorized and cross-project trigger/backfill paths; existing WorkflowInstance tests are updated to the new viewVariables/viewGantt signatures.

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(or)

Pull Request Notice

Pull Request Notice

If your pull request contains incompatible change, you should also add it to docs/docs/en/guide/upgrade/incompatible.md

@ruanwenjun ruanwenjun force-pushed the dev_wenjun_fixCvePermissionCheck branch from c2be493 to 82d7573 Compare May 2, 2026 10:14
@ruanwenjun ruanwenjun added the bug Something isn't working label May 2, 2026
@ruanwenjun ruanwenjun added this to the 3.4.2 milestone May 2, 2026
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_fixCvePermissionCheck branch 3 times, most recently from 7a2d271 to ab04b45 Compare May 3, 2026 00:18
Copy link
Copy Markdown
Member

@SbloodyS SbloodyS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…bles and trigger workflow APIs

The view-gantt / view-variables endpoints on WorkflowInstanceController
and the start-workflow-instance / batch-start-workflow-instance
endpoints on ExecutorController did not verify that the login user had
permission on the URL projectCode, allowing any authenticated user to
read another project's workflow instance details or trigger another
project's online workflows.

* WorkflowInstanceServiceImpl#viewVariables/viewGantt now require
  loginUser and call projectService.checkProjectAndAuthThrowException
  with WORKFLOW_INSTANCE before reading the instance.
* WorkflowTriggerRequest / WorkflowBackFillRequest carry the URL
  projectCode. ExecutorServiceImpl#triggerWorkflowDefinition /
  backfillWorkflowDefinition gate the call with
  checkProjectAndAuthThrowException(RERUN) and reject when the
  resolved workflowDefinition does not belong to that projectCode.
* ExecutorController and PythonGateway propagate projectCode into the
  request builders. batchTriggerWorkflowDefinitions also accepts the
  path variable so the inner per-code call inherits it.
* Both ProjectService#checkProjectAndAuth overloads are marked
  @deprecated; new code should use checkProjectAndAuthThrowException.
* New ExecutorServiceTest covers the unauthorized and cross-project
  trigger/backfill paths; existing WorkflowInstance tests are updated
  to the new viewVariables/viewGantt signatures.
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_fixCvePermissionCheck branch from ab04b45 to f628bf8 Compare May 3, 2026 04:24
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 3, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 60%)
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ruanwenjun ruanwenjun merged commit 5f11cc2 into apache:dev May 3, 2026
168 of 173 checks passed
@ruanwenjun ruanwenjun deleted the dev_wenjun_fixCvePermissionCheck branch May 3, 2026 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [API] Incorrect permission check of view-gantt/view-variables and trigger workflow APIs

2 participants