jenkinsci / jenkinsci/gerrit-trigger-plugin

[JENKINS-20312] Gerrit Trigger plugin does not correctly escape content of file provided as "Unsuccessful Message File"

Open
#650 0 comments 0 reactions 0 assignees View on GitHub
component:gerrit-trigger-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
226
Forks
289
PR merge metrics
No merged PRs in 30d

Description

A text file can be defined in the "Custom Build Messages" section of the Gerrit Trigger plugin, whose content is provided to Gerrit as an error message. The content of this file is, however, not escaped correctly, and can cause failures when the gerrit-review command is executed.

Specifically, single quotes are not escaped. As an example, use the following text as part of the message file (the dashed lines delimit the file, but are not part of it):

--------------------------------

test

this ' is ' a ' test

test

--------------------------------

The gerrit-review command will fail because the content of the second line will be provided to Gerrit as separate parameters.

---
Originally reported by dark, imported from: Gerrit Trigger plugin does not correctly escape content of file provided as "Unsuccessful Message File"


  • assignee: rsandell
  • status: Open
  • priority: Major
  • component(s): gerrit-trigger-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-06

Raw content of original issue

A text file can be defined in the "Custom Build Messages" section of the Gerrit Trigger plugin, whose content is provided to Gerrit as an error message. The content of this file is, however, not escaped correctly, and can cause failures when the gerrit-review command is executed.

Specifically, single quotes are not escaped. As an example, use the following text as part of the message file (the dashed lines delimit the file, but are not part of it):

--------------------------------
test
this ' is ' a ' test
test
--------------------------------

The gerrit-review command will fail because the content of the second line will be provided to Gerrit as separate parameters.

Contributor guide

Open the contributing guide

Research direction

Start at the Gerrit Trigger plugin's Custom Build Messages handling and the gerrit-review command invocation described in the report. Reproduce the failure with a message containing single quotes, then verify that the complete message is passed as one valid error message without command failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.