Repository navigation
Conversation
…ce and WorkflowManagerInterface - Introduced ScriptModuleInterface for module exposure in PHP scripts. - Updated ServiceTaskImplementationInterface to allow an optional timeout parameter in the run method. - Modified WorkflowManagerInterface to include a timeout parameter in the runServiceImplementation method.
…-process - Introduced ScriptRuntime facade for managing script execution context and module registration. - Added InProcessPhpRunner to run PHP scripts directly within the Laravel process. - Updated ScriptRunner to support in-process execution based on script properties. - Enhanced WorkflowManager and Script models to accommodate new functionality, including allow_in_process property. - Implemented bootstrap for in-process execution and improved error handling for script execution.
- Introduced ScriptExecutionContext to encapsulate per-run context for script modules. - The class includes properties for data, configuration, user, token ID, timeout, script ID, and source. - This addition supports the in-process execution of PHP scripts by providing necessary context information.
- Introduced CoreServiceTask class to handle the execution of allowlisted PHP scripts without Docker or the script microservice. - Implemented validation for script configuration, including script ID and user requirements. - Added support for both module-based and bare execution modes. - Enhanced error handling for various execution scenarios, ensuring robust configuration checks. - Utilized ScriptRuntime and InProcessPhpRunner for executing scripts based on the defined context.
- Enhanced ScriptController to support a new `run_in_process` property for script previews, allowing execution via an in-process PHP runner when enabled. - Updated TestScript job to handle the new `runInProcess` parameter, enabling direct script execution without Docker. - Introduced `shouldPreviewInProcess` method to determine if in-process execution is applicable based on script properties and request flags. - Added comprehensive unit tests to validate in-process execution scenarios and ensure proper handling of configuration and execution context. - Implemented new test cases for CoreServiceTask to verify in-process script execution and error handling for various conditions.
commit b84543b Author: AugustoLopezProcess <augusto.lopez+github@processmaker.com> Date: Tue Apr 21 08:27:15 2026 -0400 Adding plugin admin ui commit ca8a863 Author: Nolan Ehrstrom <github@nolanpro.com> Date: Mon Mar 9 11:01:46 2026 -0700 Add controllers and routes for plugin UI Copied from feature/plugins-poc-vite-ui (just without the vite/Vue3 integration) commit 3cc89bc Merge: 9e9b4aa 5da27ce Author: Nolan Ehrstrom <github@nolanpro.com> Date: Mon Mar 9 10:58:27 2026 -0700 Merge branch 'task/FOUR-28803' into feature/plugins-poc commit 9e9b4aa Author: Nolan Ehrstrom <github@nolanpro.com> Date: Mon Jan 19 12:30:54 2026 -0800 Add install command and cached routes commit 4a5df14 Author: Nolan Ehrstrom <github@nolanpro.com> Date: Wed Dec 10 09:29:20 2025 -0800 Start on plugins
Updating feature/plugins-poc-4 with last changes in develop
FOUR-32722 Some adjustments in plugins installation
…the command: php artisan horizon:terminate
FOUR-32760 After install/enable/disable a plugin, should be executed the command: php artisan horizon:terminate
…ink, add load screen-builder-form.js files from plugin
…ink, add load screen-builder-form.js files from plugin
…ink, add load screen-builder-form.js files from plugin
…ink, add load screen-builder-form.js files from plugin
Persist live metadata without triggering versioning behavior that deletes unpublished drafts, and hide draft or Alt B BPMN from users without edit permission. Add regression tests for draft preservation, category updates, and BPMN visibility.
Keep view-only users on published BPMN when retrieving or validating processes, and avoid labeling alternative A's XML as B. Preserve updater attribution and clear the project-asset cache when persisting metadata.
| $this->incompleteInstallPath = null; | ||
|
|
||
| try { | ||
| $zip->extractTo($tmpExtractDir); |
There was a problem hiding this comment.
Zip extract allows path traversal
Medium Severity
installFromZip calls ZipArchive::extractTo on the uploaded archive without checking entry names. Entries such as ../ can write outside the temp directory on the worker before validatePlugin runs, so a crafted zip can overwrite files on disk during plugin install.
Reviewed by Cursor Bugbot for commit 09b1416. Configure here.
Task/FOUR-34427: Create skill to optimize process and create an Alternative "B" of the process
| $alternative = 'A'; | ||
| $bpmn = $process->bpmn; | ||
| } else { | ||
| $bpmn = $this->bpmnForAlternative($process, $alternative) ?? $process->bpmn; |
There was a problem hiding this comment.
Alt B falls back to A BPMN
Medium Severity
get-process and validate-process for editors keep alternative: B even when no B version exists, then fill bpmn from live processes.bpmn (A). View-only already remaps this to A so live XML is not labeled as B; editors and validate still emit A’s definition as B. Agents can treat A as B and later write that XML onto B after enable.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit fbb9465. Configure here.
| if ($alternative === 'B') { | ||
| $this->assertAlternativeBReady($process); | ||
| } | ||
|
|
There was a problem hiding this comment.
Enable B runs before update validation
Low Severity
update-process calls ensureAlternativeBExists() before requiring a writable field. A payload with only create_alternative_b (and optionally alternative: B) clones/enables B, then fails with “Provide at least one field to update”. The failed call still mutates A/B state.
Reviewed by Cursor Bugbot for commit fbb9465. Configure here.
| /** | ||
| * Decide if script preview should use Core Service Task in-process runner. | ||
| */ | ||
| private function shouldPreviewInProcess(Request $request, Script $script): bool |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: HIGH
Description: With CORE_SERVICE_TASK_ENABLED, a user who has edit-scripts or create-scripts can run arbitrary PHP as the queue-worker OS user. Preview accepts run_in_process=true even when allow_in_process is false, and saving allow_in_process is allowed for any script editor. The run-in-process-modules permission only downgrades execution_mode to bare; bare still starts InProcessPhpRunner. That child is PHP_BINARY with the worker environment (array_merge of $_ENV and $_SERVER) and the host filesystem, then require_once's the submitted script.
Impact: Script designers are a normal product role, not administrators. Docker and the script microservice only inject EnvironmentVariable rows plus a small allowlist and do not mount the application tree. This path removes that boundary: the same user can read worker secrets (database credentials, APP_KEY, and anything else in the worker environ) and any file the app user can read, and can keep that execution on live script tasks by setting allow_in_process. The feature flag is off by default, but turning it on as documented grants this to every script editor.
Remediation: Gate bare host execution with the same administrator or run-in-process-modules grant used for modules mode, and require a persisted allow_in_process flag for preview as well as live tasks. Pass the child only the EnvironmentVariable allowlist plus the explicit API_* and HOST_URL keys that Docker already forwards, not $_ENV or $_SERVER.
Record deploy updates in package-versions VersionHistory (subject), matching the UI publish flow. Apply to deploy-screen, deploy-script, and deploy-process when the asset already exists. https://processmaker.atlassian.net/browse/FOUR-34469
Extract persistDeployedScript to satisfy Sonar rule S1142. https://processmaker.atlassian.net/browse/FOUR-34469
Bind deploy version history to newly published asset versions and reject updates when version_name is provided but publish does not create a new version. https://processmaker.atlassian.net/browse/FOUR-34469
Include preview presets in screen YAML exports and normalize imported preset data so JSON strings and YAML mappings persist consistently. Add coverage for deploy, update, and pull workflows.
Convert empty arrays to objects before JSON encoding preset data so empty YAML mappings persist as . Add coverage for top-level and nested mappings.
Ignore MySQL error 1412 when reading collection counts while allowing other query errors to propagate. Stabilize script executor and duplication tests, and remove the duplicate process request test.
…ites - Align deploy Nayra executor test with ScriptExecutorResolver contract - Grant create-scripts permission in modules duplicate script test - Disable DB transactions in DataConnectorsServerTest to avoid MySQL 1412 - Skip duplicate-request console tests until the artisan command ships https://processmaker.atlassian.net/browse/FOUR-34469
… test Duplicate validates Script::rules() and requires script_category_id in the request body; align the modules execution_mode test with existing duplicate tests. https://processmaker.atlassian.net/browse/FOUR-34469
Task/FOUR-34428: Move created vue components to plugin project
| $script->retry_wait_time = self::DEFAULT_RETRY_WAIT_TIME; | ||
| } | ||
|
|
||
| $script->code = $code; |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: HIGH
Description: POST /api/1.0/deploy-script (and the package-skeleton alias) replaces a script's PHP by title and save()s it without the modules-mode authorization applied to script create, update, duplicate, and import. Any authenticated caller who lacks run-in-process-modules can overwrite an existing script that already has allow_in_process=true and execution_mode=modules. The stored mode is left unchanged, the new code is published because code is a versionable attribute, and the next script task or core service task includes that PHP in the Laravel worker.
Impact: Process designers and any other authenticated account are not allowed to keep execution_mode=modules: ScriptController downgrades that mode to bare on update and duplicate, and import does the same. deploy-script skips that gate, so a lower-trust user can plant PHP on an administrator-marked modules script. When CORE_SERVICE_TASK_ENABLED and CORE_SERVICE_TASK_MODULES_ENABLED are on, ScriptRuntime includes that file in the worker with framework modules, the script run-as user's API token, and environment-variable values. That is in-process code execution, not the Docker or bare-subprocess path.
Remediation: Before DeployScript save()s an existing script, apply the same rule as ScriptController::authorizeModulesExecution: if execution_mode is modules and the caller is not an administrator and lacks run-in-process-modules, set execution_mode to bare or reject the request, and persist that change on the model. Calling the helper alone is not enough, because deploy-script does not fill execution_mode from the request. Leave new scripts at the bare default. Add a feature test that an edit-scripts user without run-in-process-modules can POST deploy-script against a modules script and the stored execution_mode becomes bare (or the call returns 403) so the next run cannot take the ScriptRuntime include path.
… update Pass version_name on the second deploy-screen POST so preview_presets tests align with FOUR-34469 upsert validation. https://processmaker.atlassian.net/browse/FOUR-34469
…deploy When a script update has a draft and unchanged code, HasVersioning may skip publishing a new row; attach VersionHistory to the current published version instead of returning 422. Add deploy script feature coverage for the case. https://processmaker.atlassian.net/browse/FOUR-34469
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.
There are 24 total unresolved issues (including 20 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 15b4760. Configure here.
| $this->refreshRuntimeAfterPluginChange($pluginName, $userId); | ||
|
|
||
| $this->logDone('Plugin uninstalled successfully', $pluginName, $userId); | ||
| } |
There was a problem hiding this comment.
Plugin paths allow directory traversal
High Severity
uninstall and toggle join the {name} route value into storage/plugins/{name} with no basename or traversal check, so a name like .. can rename or recursively delete outside the plugins directory. extractRepoName likewise accepts a Git URL whose last segment is .., so install can target storage/ instead of a plugin folder. The artisan uninstall command is also built from that unsanitized name.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 15b4760. Configure here.
|
|
||
| $this->info('Scheduled supervisorctl restart on this pod.'); | ||
|
|
||
| return true; |
There was a problem hiding this comment.
Reload version saved before restart
Medium Severity
applyReload records the Redis version with rememberApplied before scheduleSupervisorRestart. If scheduling fails, catch-up treats the version as applied and never retries, so that pod keeps stale plugin code until a later install increments the counter.
Reviewed by Cursor Bugbot for commit 15b4760. Configure here.
| && $this->canUseModules($request) | ||
| ? Script::EXECUTION_MODE_MODULES | ||
| : Script::EXECUTION_MODE_BARE | ||
| ); |
There was a problem hiding this comment.
Duplicate keeps in-process run-as user
Medium Severity
duplicate copies every attribute except id/uuid/timestamps, including allow_in_process and run_as_user_id. execution_mode is gated, but those fields are not. Preview then auto-runs in-process as the original run_as_user_id when allow_in_process is set, so a caller with create-scripts can execute arbitrary preview code as another user.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 15b4760. Configure here.
| * @return mixed | ||
| * | ||
| * Implementations may accept an optional 4th argument `$timeout` (seconds). | ||
| * WorkflowManager passes it when available (see CoreServiceTask). |
There was a problem hiding this comment.
Service tasks may reject timeout argument
High Severity
runServiceImplementation now takes $timeout and RunServiceTask passes it through, while ServiceTaskImplementationInterface::run still declares only three parameters. PHP 8 throws ArgumentCountError when a fourth argument is passed to a three-parameter implementation. Package service tasks that were not updated (including document-send style executors) can fail at runtime.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 15b4760. Configure here.
Redesign the plugin creation modal with MCP setup instructions, a copyable prompt, and client-flow animation. Add Claude, Cursor, and Codex icons, and validate repository URLs and Git refs before saving.
feat(FOUR-34469): require version_name on deploy upsert updates
Task/FOUR-34495: Add in the plugins creation the new UI for create the project
…nd PHP executor Add DeployCategoryResolver and wire process, script, and screen deploy endpoints to accept category names and non-empty descriptions. Prefer the standard PHP executor over php-nayra when creating scripts via deploy. https://processmaker.atlassian.net/browse/FOUR-34493


MCP Server
Related Tickets & Packages
PR's Related
ProcessMaker/modeler#1970
ProcessMaker/nayra#241
ci:deploy
ci:nayra:FOUR-34376
ci:modeler:feature/FOUR-34380