Skip to content

FOUR-34328: [EPIC] MCP - #9160

Open
caleeli wants to merge 85 commits into
developfrom
feature/FOUR-34328
Open

caleeli wants to merge 85 commits into
developfrom
feature/FOUR-34328

Conversation

@caleeli

@caleeli caleeli commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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

marcoAntonioNina and others added 30 commits July 21, 2026 15:47
…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
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

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread routes/api.php
Route::post('package-skeleton/deploy-process', [DeployProcess::class, 'deployProcess'])
->name('package-skeleton.deploy-process');
Route::get('package-skeleton/process-bpmn', [DeployProcess::class, 'getProcessBpmn'])
->name('package-skeleton.process-bpmn');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Deploy routes skip permission checks

High Severity

The new deploy and pull endpoints sit on auth:api only, with no can:create-* / can:edit-* / can:view-* checks that the matching process, screen, and script CRUD routes use. Any authenticated API user can create or overwrite assets by name and read full BPMN, YAML, and PHP. Updating an existing script keeps its run_as_user_id, so replaced code later runs as that privileged user.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b27368. Configure here.

}

$script->code = $code;
$script->save();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Script deploy ignores existing language

Medium Severity

deployScript looks up scripts only by title and, on update, writes PHP into code without changing language or script_executor_id. A JavaScript or Python script with the same title keeps its non-PHP runner, so the new body is stored as PHP but executed with the wrong executor.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b27368. Configure here.

return $php;
}

return ScriptExecutor::query()->orderBy('id')->first();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-PHP executor used for scripts

Medium Severity

After php-nayra and php, resolveForNewScript returns the lowest-id executor of any language. deployScript then stores PHP source with that executor’s language, so a new script can be created as javascript, python, or similar while its body is PHP.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b27368. Configure here.

return $match[1] . $match[2] . '${process:' . $name . '}' . $match[2];
},
$bpmn
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Process restore matches unrelated IDs

Medium Severity

restoreNamedProcessCalls rewrites any calledElement matching {anything}-{digits} when that number is a process id. In-document or external call targets such as sid-1 become ${process:…} if process 1 exists, so GET process-bpmn can corrupt BPMN that was not produced by deploy resolution.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b27368. Configure here.

->env([
'PATH' => '/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:' . (getenv('PATH') ?: ''),
])
->run(['composer', 'install', '--no-interaction']);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Agentic Security Review

Severity: MEDIUM

Description: Plugin install treats an untrusted composer.json as Composer project policy. finishPluginSetup only checks that some PSR-4 prefix starts with ProcessMaker\Plugins, ProcessMaker\Package, or ProcessMaker\Packages, then runs composer install --no-interaction with the working directory set to storage/plugins/. That invocation does not pass --no-scripts or --no-plugins and does not set COMPOSER_VENDOR_DIR. Composer runs the root package scripts (including pre-install-cmd) as the queue user, honors config.allow-plugins from that file, resolves dependencies from composer.json repositories, and installs into config.vendor-dir when set. A relative vendor-dir of ../../../vendor from storage/plugins/ is the application vendor directory. PluginServiceProvider only requires storage/plugins//vendor/autoload.php and skips the plugin when that file is absent, so a redirected install never has to load the plugin to change packages the application autoloader serves. revertFailedInstall and uninstall delete only the plugin directory, so those writes remain after a failed install or a later uninstall.

Impact: A manage-plugins operator (the permission is not on the seeded Requester, Process Designer, or Administrator groups) can submit any https git URL or zip. The author of that artifact then gets command execution as the queue worker during composer install, including when install later fails and the plugin directory is rolled back, and can replace application vendor files that stay on the shared autoloader after uninstall. That is broader than the intended plugin runtime: service providers are loaded only from the plugin's own vendor/autoload.php and only while the plugin directory remains. The worker can read the application environment and write storage; scripts run as that same user, so the reachable impact is credential disclosure and full control of the application process.

Remediation: Before composer install, reject composer.json scripts, allow-plugins, repositories, and config keys that move the install root or disable secure-http (especially config.vendor-dir). Run composer with --no-scripts --no-plugins and set COMPOSER_VENDOR_DIR to the absolute path of that plugin's vendor directory. Keep treating a loaded plugin's own service providers as a separate, explicit trust decision.

agustinbusso and others added 3 commits November 13, 2026 17:29
Persist named preview data presets for screens and versions, expose them through the screen API and MCP tools, and add Screen Builder controls to create, edit, reorder, apply, and update presets.
Proof of concept for running a PHP script without Docker
Task/FOUR-34405: Persist screen input data for preview and create data scenarios list
}
}

private function shouldRunInProcess(): bool

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Agentic Security Review

Severity: HIGH

Description: A user with only create-scripts or edit-scripts can persist allow_in_process=true and execution_mode=bare. When CORE_SERVICE_TASK_ENABLED is on, the next PHP script run through Script::runScript (process script tasks and RunScriptTask) takes ScriptRunner::shouldRunInProcess and executes the script with InProcessPhpRunner as the application user. authorizeModulesExecution and canUseModules gate only execution_mode=modules; they return immediately for bare mode. The UI checkbox is shown to every PHP script editor. InProcessPhpRunner::buildEnvironment copies the worker $_ENV and $_SERVER into the child, so the script can return worker secrets that the Docker runner never passes.

Impact: Script editors are not administrators. Docker and the script microservice previously isolated their PHP from the worker. This change lets that same editor opt the script onto the host and read the worker environment (standard Laravel boot places APP_KEY and DB_* in $_ENV/$_SERVER) and the application filesystem as the worker UID. The new run-in-process-modules permission shows modules-in-worker execution was meant to be privileged; the bare host path skips that gate. Reachable only after CORE_SERVICE_TASK_ENABLED=true (default false), but enabling the feature is the supported configuration and the editor can then script the API end to end.

Remediation: Require is_administrator or a dedicated permission before allow_in_process can be stored or before ScriptRunner::shouldRunInProcess and the preview in-process path honor it. Do not treat bare mode as the safe fallback for callers who fail the modules check. Pass the PHP subprocess only the same environment allowlist the Docker runner uses, not $_ENV/$_SERVER.

Comment thread routes/api.php
Route::post('scripts/microservice/execution', [ScriptController::class, 'microserviceExecution']);

// Deploy / sync helpers (core). Canonical paths + package-skeleton aliases for BC.
Route::post('deploy-script', [DeployScript::class, 'deployScript'])->name('deploy-script');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Agentic Security Review

Severity: HIGH

Description: The new deploy and get-by-name routes for scripts, screens, and processes are registered inside the auth:api group with no can: middleware and no controller authorize() call. Any logged-in user, including a Requesters-group account that cannot create, edit, or view these assets, can read published script PHP, screen YAML, and process BPMN by title or name and can create or overwrite those records. DeployScript sets run_as_user_id only when inserting a new row, so an update keeps the existing run-as user, publishes the attacker PHP as the latest script version, and the next script task runs that code with a freshly minted API token for that user. DeployProcess likewise replaces BPMN by name and marks a newly created process ACTIVE. A script task in that BPMN with no pm:scriptRef runs inline code as the first administrator.

Impact: This crosses the designer permission boundary that already gates the sibling script, screen, and process APIs. A normal requester session (Passport laravel_token from web login, or any other auth:api token) can replace a production script or process definition. Script execution then uses the preserved run_as_user_id and GenerateAccessToken, so the attacker PHP receives that user's API credential. Inline BPMN script bodies with an empty scriptRef use Script::defaultRunAsUser(), the first administrator. Screen YAML updates publish config, computed, watchers, and custom CSS for later renders.

Remediation: Put the same CustomAuthorize abilities used by the existing resource routes on both the canonical and package-skeleton aliases: can:create-scripts on create, can:edit-scripts on the resolved script for update, can:view-scripts for getScriptPhp, and the matching create/edit/view abilities for screens and processes. After the title or name lookup, call authorize() on that model so project-scoped edit checks still apply. Do not upsert or return source by title or name alone. On script update, do not keep a foreign run_as_user_id unless the caller is allowed to edit that script.

}

TestScript::dispatch($script, $request->user(), $code, $data, $config, $nonce)->onQueue('bpmn');
if ($request->boolean('run_in_process')) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Agentic Security Review

Severity: HIGH

Description: With Core Service Task enabled, POST /api/1.0/scripts/{script}/preview runs the request body's PHP on the host when run_in_process is true, without the allow_in_process gate that task execution enforces. The route only requires view-scripts, which is separate from edit-scripts, so a caller who cannot save allow_in_process or change the script can still queue that host run. TestScript passes the unsaved request code to InProcessPhpRunner. The subprocess is the configured PHP binary, started from the queue worker with array_merge($_ENV, $_SERVER), every decrypted EnvironmentVariable, and a Passport API token for the script's run-as user. The script return value is broadcast back to the caller on ScriptResponseEvent. ScriptExecutionModeResolver forces bare mode when allow_in_process is false, so this path does not enter ScriptRuntime modules, but the bare host process is enough.

Impact: Enabling CORE_SERVICE_TASK_ENABLED is documented as an opt-in host runner limited to scripts with allow_in_process=true. Preview treats a client boolean as that decision and executes unsaved code as the bpmn queue worker. A view-scripts user (not granted to the default Requesters group, and not the same permission as edit-scripts) can read worker secrets and environment-variable values that the environment-variables API withholds, act as the script run-as user for the duration of the process, and return the results on their private broadcast channel. Task runs and CoreServiceTask still refuse the same host path unless allow_in_process is set. The preview-before-save flag is covered by testPreviewScriptInProcessWithRequestFlag, but that does not authorize view-only callers or this environment.

Remediation: Use the same allow_in_process requirement as ScriptRunner::shouldRunInProcess for preview. Do not let the request flag alone select host execution. If unsaved in-process preview must remain, require edit-scripts or a dedicated in-process permission, and only for callers who could already persist the gate. Pass the subprocess a scrubbed environment containing the intended script variables and a short-lived run-as token, not the worker $_ENV/$_SERVER or every environment-variable secret.

*/
private function buildEnvironment(?User $user, ?GenerateAccessToken $accessToken): array
{
$env = array_merge($_ENV, $_SERVER);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Agentic Security Review

Severity: HIGH

Description: Bare in-process PHP execution copies the queue worker's full process environment into the script subprocess. A Process Designer (view-scripts / edit-scripts) can return getenv('APP_KEY'), getenv('DB_PASSWORD'), and the other worker secrets through the normal script output. Docker and ScriptMicroserviceRunner only pass EnvironmentVariable rows, HOST_URL, and an API token.

Impact: Process Designers are allowed to author PHP, but they are not the worker secret store. With CORE_SERVICE_TASK_ENABLED, preview or an allow_in_process script runs on the bare runner and the script return value is delivered back to that user. That exposes application credentials the microservice and Docker runners deliberately omit, including APP_KEY and database passwords from the worker environment. Those credentials decrypt application data and open the database. The bare checkbox is not gated by run-in-process-modules; the default Process Designers group has view-scripts, create-scripts, and edit-scripts only.

Remediation: Build the bare subprocess environment the same way ScriptMicroserviceRunner::getEnvironmentVariables does: EnvironmentVariable rows, HOST_URL/APP_URL, smart-extract settings, and the per-run API token. Do not array_merge $_ENV or $_SERVER. If a few host binaries are required, pass an explicit allowlist such as PATH. Because this process still runs as the worker user, also confine it (separate user, open_basedir, or a root that cannot read .env and bootstrap/cache/config.php); otherwise the same script can read those files even after the environment is curated.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

{
$instances = $this->instantiateModules($context);
$scriptPath = $this->writeTempScript($code);
$hasExplicitReturn = $this->hasExplicitReturn($code);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Return detection skips PHP normalization

High Severity

hasExplicitReturn tokenizes the original script body, while writeTempScript first prepends <?php when it is missing. ProcessMaker scripts usually omit that tag, so token_get_all treats the body as inline HTML and never sees T_RETURN. An explicit return 1 or return null then looks like a successful include, and the runtime substitutes the default $result error array instead of the returned value, which can overwrite process data in modules execution.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8cd1706. Configure here.

},
onPreviewPresetsReorder() {
this.persistPreviewPresets();
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reorder leaves stale preset selection

Medium Severity

Dragging preview presets persists the new order but does not remap activePreviewPresetIndex. The radio stays on the old numeric index, so a different preset appears selected while Monaco still shows the previous payload, and the dirty Update/Discard controls compare against the wrong preset.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8cd1706. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

}

$request->merge(['execution_mode' => Script::EXECUTION_MODE_BARE]);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Script update strips modules mode

Medium Severity

authorizeModulesExecution treats a missing execution_mode as the script’s current value. On update, a user with edit-scripts but without run-in-process-modules therefore merges execution_mode to bare and fill() persists it, even when they only changed title or code. Modules mode is silently cleared instead of being left alone or rejected.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0b976d2. Configure here.

$submenu->add(__('Plugins'), [
'route' => 'plugins.index',
'icon' => 'fa-plug',
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Plugins menu ignores manage-plugins

Medium Severity

The Plugins item is added only inside the is_administrator block, while the page and API require manage-plugins. Admin home also redirects view-plugins to plugins.index. Non-admin users with manage-plugins never see the menu; users with only view-plugins are sent to a route that 403s.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0b976d2. Configure here.

@pmPaulis pmPaulis changed the title FOUR-34328: [EPIC] MCP Server FOUR-34328: [EPIC] MCP Nov 16, 2026
pmPaulis and others added 7 commits November 17, 2026 08:14
FOUR-34401 Register VueRenderPreview for screen builder initialization
Add a tool to enable Alternative B and support selecting A or B when retrieving, validating, and updating process BPMN drafts.
Hydrate draft versions only when updating BPMN, and persist accompanying metadata without overwriting the published process definition. Add regression tests for metadata-only and combined updates.
Comment thread config/mcp.php
|
*/

'redirect_domains' => [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Agentic Security Review

Severity: HIGH

Description: MCP dynamic client registration is public, and config('mcp.redirect_domains') is ['*']. laravel/mcp v0.6.5 (locked at 583a6282) treats that wildcard as allow-all for every http/https redirect_uri, then stores it on a public Passport client. After a logged-in user approves the normal consent screen, Passport sends the authorization code to that attacker URL. The registrant has the PKCE verifier and can redeem the code at the token endpoint. The resulting bearer token is accepted by auth:api with no scope check, so it carries the approving user's full API authority, not only mcp:use.

Impact: An internet client with no ProcessMaker account can register an OAuth client whose redirect_uri is an attacker host. The consent screen still requires the victim to click Authorize, but the client name is attacker-chosen and the allowlist that the config comment describes is disabled. A successful approval discloses an API bearer token (and refresh token) for that user. Custom schemes (cursor, vscode, claude, vscode-insiders) are already listed separately and do not need '*'.

Remediation: Remove '*'. Allow only intended HTTPS origins, plus http://localhost and http://127.0.0.1 if loopback native callbacks are required. Keep custom_schemes limited to cursor, vscode, vscode-insiders, and claude. Reject registration and authorization redirect_uris that do not match that list. Do not rely on the consent screen as the redirect allowlist.

?string $canonicalRepoUrl = null,
): void {
try {
$process = Process::timeout(3600)->run(['git', 'clone', $repoUrl, $destination]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Agentic Security Review

Severity: MEDIUM

Description: Plugin install places GITHUB_TOKEN or the operator-supplied git_token in the git argv and, while fetching an existing checkout, in the plugin remote URL. prepareGitUrl builds an https URL with the secret in the userinfo. cloneRepository passes that URL to git clone, and updateExistingRepository writes it with git remote set-url before fetch/pull. Log redaction only scrubs logged strings and queued failure messages. Both cleanups ignore the set-url result, so a failed cleanup leaves the secret in .git/config. Any other user in the worker PID namespace can read the clone and set-url arguments from the process list for the whole clone/fetch.

Impact: The credential that authenticates private plugin fetches becomes visible to a lower-trust local user who can see the queue worker's command line. That user does not need manage-plugins and cannot read the worker environment or .env, but ps and /proc//cmdline are world-readable in a normal shared PID namespace. Capturing the token lets them reuse the install identity against GitHub. This is local cross-user disclosure of a supply-chain credential, not a new privilege for the plugin itself: after clone, composer and the plugin install command already run as the worker user.

Remediation: Do not put the token in the clone URL. Pass it through GIT_ASKPASS or a short-lived git credential helper (or http.extraheader) so it never appears in argv or remote.origin.url. Treat a failed credential strip as an install failure and remove the checkout if the clean set-url does not succeed.

agustinbusso and others added 3 commits November 18, 2026 13:45
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.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

$this->incompleteInstallPath = null;

try {
$zip->extractTo($tmpExtractDir);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 2 potential issues.

There are 20 total unresolved issues (including 18 from previous reviews).

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 fbb9465. Configure here.

$alternative = 'A';
$bpmn = $process->bpmn;
} else {
$bpmn = $this->bpmnForAlternative($process, $alternative) ?? $process->bpmn;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fbb9465. Configure here.

if ($alternative === 'B') {
$this->assertAlternativeBReady($process);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants