loadYamlContent() replaces trailing newline in YAML block scalar with NUL (U+0000)
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 79
Description
**0.47.16**
When a multi-line string is loaded from a YAML literal block scalar (|) using loadYamlContent(), Bicep can introduce a NUL character (U+0000) into the resulting string — specifically by replacing the block’s trailing newline with \u0000 instead of preserving it as \n.
Expected: The Bicep string value matches the YAML content byte-for-byte for line endings: all line breaks remain normal \n characters (including the final newline that YAML block scalars normally retain).
Actual: At least one \n in the loaded string is replaced with \u0000. The corruption is invisible in editors and logs but shows up when inspecting code points (e.g. unicode_codepoints_from_string() in Kusto) or when the string is deployed as a resource property.
Impact: We deploy Azure Data Explorer (ADX) database scripts via Microsoft.Kusto/clusters/databases/scripts and scriptContent. ADX management scripts expect newline-separated KQL commands. NUL bytes are not valid line separators for authoring/deployment which causes parsing problems.
Contributor guide
Research direction
Start at the loadYamlContent() entry point and trace handling for YAML literal block scalars (|). Reproduce a multiline value with a trailing newline and inspect its code points, then verify that all line breaks, including the final one, remain \n and no NUL character is introduced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- yaml
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100