Skip to content

Conversation

@pmPaulis
Copy link
Contributor

@pmPaulis pmPaulis commented Jan 8, 2026

Issue & Reproduction Steps

TCE Military V1 - Phase 1: Update Script Executor for Intake

Solution

  • List the changes you've introduced to solve the issue.

How to Test

Describe how to test that this solution works.

Related Tickets & Packages

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.

Note

Introduces flexibility in executor builds and Nayra runtime configuration.

  • Extends processmaker:build-script-executor to accept --build-args and appends them to docker build (e.g., --build-arg key=value).
  • Makes Nayra port configurable via config('app.nayra_port') (defaults to 8080); removes static port usage and uses getNayraPort() in URLs and container startup.
  • Updates Nayra container run logic to set -e PORT=<port> on host network or -p <port>:8080 on other networks, applied when port != 8080.
  • Adds nayra_port to config/app.php and uses it throughout Nayra Docker handling.

Written by Cursor Bugbot for commit bb21d76. This will update automatically on new commits. Configure here.

devmiguelangel and others added 2 commits December 18, 2025 10:31
FOUR-28393 BASES Improve the script executor building
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on January 21

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

}

return [];
}
Copy link

Choose a reason for hiding this comment

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

Shell command injection via unsanitized build-args input

High Severity

The getBuildArgs() method constructs shell command arguments by directly concatenating user-supplied input from the --build-args option without escaping. The value is split by comma and each part is appended as --build-arg $arg to the Docker command, which is then passed to system() or proc_open(). An attacker could inject arbitrary shell commands (e.g., --build-args="FOO=bar; malicious-command"). The codebase uses escapeshellarg() elsewhere for this purpose, such as in ScriptRunners/Base.php and TenantsCreate.php.

🔬 Verification Test

Why verification test was not possible: This is a shell command injection vulnerability that would require actually running the artisan command with malicious input against a Docker environment. Running such a test could cause unintended system changes. However, the vulnerability is evident from code inspection: the $arg variable from user input is directly concatenated into a shell command string ('--build-arg ' . $arg) without any call to escapeshellarg(), and this string is ultimately passed to system() or proc_open(). The pattern used elsewhere in the codebase (e.g., escapeshellarg() in Base.php lines 88, 181, 190) demonstrates the expected sanitization that is missing here.

Additional Locations (1)

Fix in Cursor Fix in Web

@ryancooley ryancooley requested a review from nolanpro January 12, 2026 17:53
@pmPaulis pmPaulis changed the title FOUR-27925: [TCE] TCE Military V1 FOUR-28753: [TCE] TCE Military V1 - Phase 1: Update Script Executor for Intake Jan 12, 2026

foreach ($buildArgs as $buildArg) {
$command .= ' ' . $buildArg;
}
Copy link

Choose a reason for hiding this comment

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

Build args appended after docker build context path

Medium Severity

The --build-arg options from getBuildArgs() are appended after the build context path {$packagePath} in the docker build command. Docker build syntax requires all options to precede the PATH argument (docker build [OPTIONS] PATH). The resulting command places --build-arg values after the context path, which means the new --build-args feature will not work correctly as Docker expects the build context to be the final argument.

Fix in Cursor Fix in Web

exec(
$docker . ' run -d --name ' . $instanceName . '_nayra '
$docker . ' run -d '
. ($this->getNayraPort() !== 8080 ? '-p ' . $this->getNayraPort() . ':8080 ' : '')
Copy link

Choose a reason for hiding this comment

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

Port mapping missing in executor build startup path

Medium Severity

The commit adds port mapping logic to bringUpNayra (the instance method) but not to bringUpNayraExecutor (the static method called during build at line 176 of BuildScriptExecutors.php). When a Nayra executor is built, bringUpNayraExecutor starts the container without the -p port mapping flag. Later, getNayraInstanceUrl() constructs a URL using the configured port, but the container wasn't started with that port mapped, causing connection failures when a custom nayra_port is configured.

Fix in Cursor Fix in Web

@processmaker-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants