GeezerVison is showing github.com — FOUR-34303 SQLi /api/1.0/processes/{process}/aggregation by devmiguelangel · Pull Request #9130 · ProcessMaker/processmaker
Conversation
devmiguelangel
commented
Nov 10, 2026
•
edited by atlassian
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue & Reproduction Steps
SQLi /api/1.0/processes/{process}/aggregation
processes.aggregation was stored with no validation and later interpolated into Process::getProcessStageCounts():
sprintf("JSON_EXTRACT(data, '$.%s')", $amountKey)
A user who can create processes could save a value that closed the string literal and injected SQL into the SELECT list. The query ran on GET /api/1.0/processes/{process}/stage-mapping. The same column is also mass-assignable on process create, update, and import.
Solution
- Bind the JSON path in
getProcessStageCounts() and fall back to amount when the stored value is not a variable name.
- Validate every write through
AggregationVariable (Process::rules(), saveAggregation) and the HasAggregationAttribute mutator on Process and ProcessVersion, which also covers import.
- Share the allowlist in
JsonDataPath. BaseFilter now builds its JSON path through the same helper.
How to Test
./vendor/bin/phpunit 'tests/Feature/Api/ProcessControllerTest.php'
./vendor/bin/phpunit 'tests/Feature/ImportExport/Exporters/ProcessExporterTest.php'
./vendor/bin/phpunit 'tests/unit/ProcessMaker/FilterTest.php'
./vendor/bin/phpunit 'tests/unit/ProcessMaker/Support/JsonDataPathTest.php'
./vendor/bin/phpunit 'tests/unit/ProcessMaker/Rules/AggregationVariableTest.php'
Related Tickets & Packages
FOUR-34303
Code Review Checklist
- I have pulled this code locally and tested it on my instance, along with any associated packages.
- This code adheres to ProcessMaker Coding Guidelines.
- This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
- This solution fixes the bug reported in the original ticket.
- This solution does not alter the expected output of a component in a way that would break existing Processes.
- This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
- This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
- This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
- This ticket conforms to the PRD associated with this part of ProcessMaker.
ci:deploy
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…rocessController and Process model
cursor
Bot
commented
Nov 10, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
PR Summary
Medium Risk
Touches SQL construction and mass-assignable process fields; legacy aggregation values change behavior on version/duplicate but stage queries are hardened with fallbacks and parameter binding.
Overview
Fixes SQL injection where processes.aggregation was interpolated into JSON_EXTRACT in stage-mapping queries by binding a validated JSON path and defaulting to amount when stored values are invalid.
Adds shared JsonDataPath (plus AggregationVariable and HasAggregationAttribute) so create/update/import/save-aggregation and model mutators only accept variable-style names; BaseFilter builds filter JSON paths through the same helper. Legacy tampered values no longer break saves/duplicates/versions—they are coerced to the default on copy while reads still use the safe bound path.
Reviewed by Cursor Bugbot for commit 96d1fd9. Bugbot is set up for automated code reviews on this repo. Configure here.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
devmiguelangel
changed the title
fix(processes): bind aggregation json path to prevent SQL injection
FOUR-34303 SQLi /api/1.0/processes/{process}/aggregation
Nov 10, 2026
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.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6b2ccfa. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…rsion models to support legacy data
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
pmPaulis
Awaiting requested review from pmPaulis
At least 1 approving review is required to merge this pull request.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|