C++ rule messages are not safely escaped in Azure DevOps pull request decorations

Environment:

  • Product: SonarQube Server
  • SonarQube Server version: 2025.4.4.119049
  • Language: C++
  • Rule: cpp:S100
  • ALM: Azure DevOps
  • Analysis type: Pull request analysis

Problem description:
Issue messages containing regular expressions are rendered incorrectly when they
are published as Azure DevOps pull request decorations.

The C++ rule cpp:S100 reports a message containing a regular expression. In the
SonarQube UI, the message is displayed correctly. However, after the issue is
published as an Azure DevOps pull request comment, Markdown characters in the
regular expression are interpreted by Azure DevOps instead of being displayed
literally.

Example: Our rule parameter is:
^([A-Za-z0-9]*[a-z]+[A-Za-z0-9]*_?)*$
PR decoration is:

Notice the missing *.

Steps to reproduce:

  1. Set up our regex in cpp:S100.
  2. Enable Azure DevOps pull request decoration.
  3. Run a SonarQube C++ pull request analysis.
  4. Trigger rule cpp:S100 on a changed line.
  5. Open the decorated Azure DevOps pull request.
  6. Compare the issue message in SonarQube with the corresponding Azure DevOps
    pull request comment.

Expected behavior:
The complete issue message should be displayed literally in Azure DevOps.
Regular expressions and other Markdown-significant characters must be escaped or
wrapped in a suitable code span/code block before the comment is sent to Azure
DevOps.

Actual behavior:
The issue message is interpreted as Markdown by Azure DevOps. As a result, the
regular expression is incomplete or visually corrupted in the pull request
decoration, although the original issue message is correct in SonarQube.

Impact:
This makes rule explanations incomplete and potentially changes their meaning.
Developers reviewing issues in Azure DevOps cannot reliably understand the
recommended fix without opening SonarQube.

Additional information:
The SonarQube Server documentation states that issues detected on pull requests
are published as comments on the Azure DevOps pull request. This appears to be
an escaping problem in the PR decoration payload rather than a problem in the
C++ rule message itself. Probably other rules and languages are also affected.

Could you please confirm whether this is a known limitation or bug?

1 Like