GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — FOUR-34303 SQLi /api/1.0/processes/{process}/aggregation by devmiguelangel · Pull Request #9130 · ProcessMaker/processmaker

Conversation

@devmiguelangel

@devmiguelangel devmiguelangel commented Nov 10, 2026 •
edited by atlassian Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

All reactions
devmiguelangel added 8 commits November 10, 2026 11:00
@devmiguelangel
feat: add JsonDataPath class for safe mysql json path construction
f27a9db
@devmiguelangel
test: add unit tests for JsonDataPath class validation and quoting
15dcd1f
@devmiguelangel
refactor: enhance filter field validation in BaseFilter using JsonDat…
a6b6c5f
…aPath
@devmiguelangel
feat: implement aggregation JSON path resolution in Process model
106cedf
@devmiguelangel
feat: add AggregationVariable validation rule and integrate it into P…
56ca127
…rocessController and Process model
@devmiguelangel
test: add unit tests for AggregationVariable validation rule
130ff6f
@devmiguelangel
feat: integrate HasAggregationAttribute trait into Process and Proces…
4360371
…sVersion models
@devmiguelangel
test: enhance aggregation validation tests to reject SQL injection pa…
6b2ccfa
…yloads
@cursor

cursor Bot commented Nov 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devmiguelangel 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
@devmiguelangel devmiguelangel self-assigned this Nov 10, 2026
cursor[bot]
cursor Bot reviewed Nov 10, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Fix All in Cursor

❌ 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.

All reactions
Comment thread ProcessMaker/Traits/HasAggregationAttribute.php Resolved

Uh oh!

There was an error while loading. Please reload this page.

@cursor
cursor Bot requested review from gproly and nolanpro November 10, 2026 16:06
@devmiguelangel
feat: enhance aggregation handling in ProcessController and ProcessVe…
d86e1fd
…rsion models to support legacy data
@devmiguelangel
devmiguelangel removed request for gproly and nolanpro November 10, 2026 16:29
@nolanpro

nolanpro commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://tenant-1.ci-cab54a1756.engk8s.processmaker.net

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devmiguelangel
devmiguelangel requested a review from pmPaulis November 10, 2026 17:23
@devmiguelangel
fix(sq): replace count check with empty check in JsonDataPath
96d1fd9
@nolanpro

nolanpro commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://tenant-1.ci-cab54a1756.engk8s.processmaker.net

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@decisions-sonarqube

decisions-sonarqube Bot commented Nov 10, 2026

Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
98.4% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@pmPaulis 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.

Assignees

@devmiguelangel devmiguelangel

Labels

None yet

Projects

None yet

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.

2 participants

@devmiguelangel @nolanpro
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.