Repository navigation
Conversation
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
PR SummaryMedium Risk Overview A shared Reviewed by Cursor Bugbot for commit 76546bf. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
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.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 76fe727. Configure here.
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
|
|
||
| private function resolvePublishedVersionAfterSave(Model $asset, int $publishedVersionIdBefore): ?Model | ||
| { | ||
| $version = $asset->versions()->published()->orderByDesc('id')->first(); |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: MEDIUM
Description: Deploy version history is bound to the newest published version id after save, not to the version row this request inserted. On deploy-screen and deploy-script that lookup is outside a transaction, so a concurrent update of the same screen or script can commit a higher version id that this request then records as its own publish. The history row stores this caller's user id, version_name, and version_description on that other version. Export reads the first VersionHistory row for the latest version as last_modified_by, so the published screen or script can be attributed to the other deployer.
Impact: Two authenticated API users who can call deploy-screen or deploy-script (auth:api only; these routes have no asset permission middleware) can interleave updates of the same title. The slower resolver stamps the newer version row with the slower caller's identity and version label. That crosses the request-to-version authorship boundary: exporter manifests then report the wrong user as last_modified_by for the latest published screen or script. Executable screen config and script code are unchanged; the damage is cross-user publisher attribution and version-label integrity. The deploy-process path keeps the snapshot, save, and history insert in one transaction on the default MySQL InnoDB connection, so it does not observe the other deploy's committed version under REPEATABLE READ.
Remediation: Pass the version model returned by this request's saveVersion/saved hook into the history insert and set versionable_id to that id only. Do not re-select the latest published id. Keep screen and script snapshot, save, and history insert on that same version id so a newer concurrent row cannot match.
|





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