Skip to content

Safe-output sanitizer escapes template delimiters inside GitHub suggestion blocks #28691

Closed

Description

@theletterf

Summary

Safe-output sanitization escapes template delimiters inside GitHub suggestion fenced code blocks. This makes PR review suggestions unsafe to apply when the suggested replacement contains legitimate documentation syntax that uses double curly braces, such as Elastic documentation substitutions.

Reproduction

Have an agentic workflow create a pull request review comment with a GitHub suggestion block like this:

```suggestion
Refer to [Advanced {{fleet-server}} options](/reference/fleet/fleet-server-scalability.md#fleet-server-configuration).
```

The rendered review suggestion becomes:

```suggestion
Refer to [Advanced \{\{fleet-server}} options](/reference/fleet/fleet-server-scalability.md#fleet-server-configuration).
```

If a human clicks Commit suggestion, GitHub applies the backslashes literally and changes the source file to \{{fleet-server}}, breaking the documentation substitution.

Expected behavior

Sanitization should preserve the contents of fenced code blocks, including GitHub suggestion fences. The Safe Outputs specification says code blocks and inline code must not be sanitized, and a suggestion block is a fenced code block whose contents are intended to be applied literally.

Actual behavior

The safe-output sanitizer neutralizes {{ inside the suggestion fence, changing apply-ready patch text.

Impact

This affects documentation repositories that use template-like syntax as source content. In Elastic docs, {{...}} is valid substitution syntax, so escaped braces in a suggestion block produce an incorrect patch when accepted.

Notes

This appears related to template delimiter sanitization from #15015, which intentionally neutralizes patterns like {{ to \{\{. That behavior makes sense for normal comment text, but not inside fenced code blocks, especially suggestion blocks where the content is executable patch text.

Activity

  1. locked and limited conversation to collaborators on Apr 27, 2026
  2. unlocked this conversation on Apr 27, 2026
  3. theletterf commented on Apr 27, 2026

    @theletterf
    Author

    @pelikhan Thanks! Sorry for all the issues — I'm having a blast using gh-aw and think they might be useful. :)

  4. locked and limited conversation to collaborators on Apr 27, 2026
  5. unlocked this conversation on Apr 27, 2026
  6. pelikhan commented on Apr 27, 2026

    @pelikhan
    Collaborator

    Keep them coming! They are incredibly useful!

  7. theletterf commented on Apr 29, 2026

    @theletterf
    Author

    Is a release happening soon? 🤞🏻

  8. locked and limited conversation to collaborators on Apr 29, 2026
  9. unlocked this conversation on Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions