Skip to content

A $ that does not start a placeholder is corrupted by StringPropertyReplacer #55326

Closed

Description

@payallenka

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

core

Bug Description

StringPropertyReplacer.replaceProperties mishandles a $ that is not followed by {. After reading the $ it reads one more character and, if that is not {, pushes both back as raw bytes. That breaks three cases:

  1. $ at the end of the input: the look-ahead is -1, which is pushed back as the byte 0xFF, so a stray U+FFFD is appended.
  2. $ right before a placeholder ($${b}): the second $ is replayed raw, so the placeholder after it is not replaced.
  3. $ right before the closing brace of a placeholder (${x:5$}): the replayed } bypasses the brace tracking, so the placeholder is never closed.

The replacer is used for workflow notify-user subjects and messages (NotifyUserStepProvider), theme properties (DefaultThemeManager), SAML config parsing (StaxParserUtil), the authz client config and realm import placeholders, so e.g. a notification message ending in "25 $" is sent as "25 $�".

Version

main (nightly)

Regression

  • The issue is a regression

Expected behavior

A $ that does not start a placeholder is kept as-is and does not affect what follows (with a=A, b=B, x unset):

"${a}$"          -> "A$"
"${a}$${b}"      -> "A$B"
"${x:5$} ${b}"   -> "5$ B"

Actual behavior

"${a}$"          -> "A$�"
"${a}$${b}"      -> "A$${b}"
"${x:5$} ${b}"   -> "${x:5$} B"

How to Reproduce?

Map<String, String> props = Map.of("a", "A", "b", "B");
StringPropertyReplacer.replaceProperties("${a}$", props::get);        // "A$�"
StringPropertyReplacer.replaceProperties("${a}$${b}", props::get);    // "A$${b}"
StringPropertyReplacer.replaceProperties("${x:5$} ${b}", props::get); // "${x:5$} B"

Anything else?

I have a fix with tests and can open a PR: keep the look-ahead character and run it through the normal processing on the next read instead of replaying it raw.

Activity

  1. added theissue type on Nov 19, 2026
  2. added
    area/coreCore server — startup, configuration, providers/SPIs, cross-cutting concerns
    on Nov 19, 2026
  3. self-assigned this
    on Nov 19, 2026
  4. ahus1 commented on Nov 19, 2026

    @ahus1
    Member

    Sorry for this bug, and thanks for reporting it.

    How to escape a $ sign in plain text has never been defined, which is unfortunate. I agree that the examples 1 and 3 are definitely wrong. But the second case woud need more discussion on how to escape a $ sign: not at all, with a backslash, or double dollar.

    I'll be pushing a change to the PR fixing only 1 and 3. Let's discuss over there in the pull request.

  5. ahus1 commented on Nov 19, 2026

    @ahus1
    Member

    Follow-up issue #55355

    Escaping would be a breaking change, so the follow-up issue would be 27.0 only. This the other changes in the linked PR are obvious bug and can be fixed and backported to previous releases.

  6. added 4 commits that reference this issue on Nov 19, 2026
    4dba8fc
    57dec6d
    f5f3bd3
    4c7a019
  7. added a commit that references this issue on Nov 19, 2026
    994ee7e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Fields

No fields configured for bug.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions