Handle asterisk placeholder values in YAML parser#6626
Merged
Conversation
Values like `*** REMOVED ***` or `**REDACTED**` are used as credential
placeholders but cause SnakeYAML to interpret them as alias references,
resulting in parse failures. Apply the same UUID substitution strategy
already used for `@variable@` patterns: replace values starting with
two or more asterisks with UUIDs before parsing, then restore them
in the resulting AST.
Fixes moderneinc/customer-requests#1463
3 tasks
knutwannheden
added a commit
that referenced
this pull request
Apr 23, 2026
…lars (#7466) The asterisk placeholder preprocessing (introduced in #6626 to handle credential values like `*** REMOVED ***`) replaces matched text with UUIDs before parsing and restores them afterward. Restoration for the variable/asterisk UUID map used exact-match against the scalar value, so when the regex matched inside a multi-line block scalar — e.g. markdown bold like `**CI Alert**` on a line containing `: ` from an emoji — the UUID was embedded within a longer scalar value and never restored, breaking print idempotency. Align restoration with the helm and single-brace template maps on the same code path, which already use `contains`/`replace`. UUIDs are random per-parse and only produced by the parser, so substring replacement is unambiguous.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
**(e.g.,*** REMOVED ***,**REDACTED**)@variable@and Helm templatesProblem
Credential placeholders like
*** REMOVED ***cause SnakeYAML to interpret the leading*as an alias indicator. Since no matching anchor exists, parsing fails with anUnsupportedOperationException, and the file is returned as aParseError.Solution
Added
ASTERISK_PLACEHOLDER_PATTERNthat matches values after a colon starting with two or more asterisks. Before SnakeYAML processes the YAML, these values are replaced with UUIDs. After parsing, the original values are restored in the AST. This follows the exact same pattern already used for@variable@placeholders.The pattern specifically requires two or more consecutive asterisks (
\*{2,}) to avoid interfering with valid single-*YAML alias references.Test plan
Existing
YamlParserTesttests passNew
asteriskPlaceholderstest verifies*** REMOVED ***and**REDACTED**parse correctlyNew
asteriskPlaceholdersWithAnchorstest verifies real anchors/aliases coexist with placeholdersFixes moderneinc/customer-requests#1463