Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web version incorrectly renders alert title and message (html escape) #3168

Open
MrEcco opened this issue Oct 19, 2023 · 3 comments
Open

Web version incorrectly renders alert title and message (html escape) #3168

MrEcco opened this issue Oct 19, 2023 · 3 comments
Labels
awaiting input Awaiting input/answer from user responsible for the issue/PR bug Something isn't working part:alert flow & configuration

Comments

@MrEcco
Copy link
Contributor

MrEcco commented Oct 19, 2023

What went wrong?

What happened:

Then Grafana OnCall receives alerts from alertmanager, it shows this alert in Slack and in the Web version (right in Grafana, "Home -> Alerts & IRM -> OnCall" page). For Web, I see special symbols like " instead of ". This is probably because of improper HTML escaping. For Slack, the message is looks perfect.

Example:

  • In Slack: ... metrics from "postgres-exporter-main" PostgreSQL ...
  • In Web: ... metrics from "postgres-exporter-main" PostgreSQL ...
  • In alertrule yaml document:
groups:
  - name: postgresql
    rules:
    - alert: PostgreSQLExporting
      expr: changes(pg_exporter_last_scrape_error[15m]) > 0
      for: 3m
      labels:
        severity: critical
        kind: database
      annotations:
        title: Cannot collect metrics from "{{ $labels.release }}" PostgreSQL instance
        description: ...

What did you expect to happen:

Just a correctly rendered message in the Web version, without escaped versions of symbols instead of the symbol itself.

How do we reproduce it?

  1. Create alertrule with one or more symbols that should be escaped in the HTML. For example any of these: &"<>
groups:
  - name: postgresql
    rules:
    - alert: ExampleRuleWithDetailedMessage
      expr: vector(1) > 0 # always fires
      for: 1m
      labels:
        severity: critical
      annotations:
        title: See here: "{{ $labels }}"
  1. Use such message templating for the alertmanager integration, that collects .annotation.title to the title message (and/or description)
{{ annotations.title }}
  1. Fire the alert

  2. Check Web and Slack messages. Web version contains &quot; in the places where " should be present

Grafana OnCall Version

1.3.43 (grafana plugin), 1.3.42 (oncall instance)

Product Area

Alert Flow & Configuration, Other

Grafana OnCall Platform?

Kubernetes

User's Browser?

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36

Anything else to add?

Might be related to this: #3149

@MrEcco MrEcco added the bug Something isn't working label Oct 19, 2023
@MrEcco MrEcco changed the title Web version incorrectly renders alert title and message Web version incorrectly renders alert title and message (html escape) Oct 19, 2023
@MrEcco
Copy link
Contributor Author

MrEcco commented Oct 19, 2023

Screenshots always speak thousands words :)

Web version:
image

Slack version:
image

@MrEcco
Copy link
Contributor Author

MrEcco commented Oct 26, 2023

Image templating too:
image
image

This will never work in UI, but it works perfectly for Slack.

@joeyorlando
Copy link
Contributor

@MrEcco can you try upgrading to the latest version (v1.7.1 as of this writing) and see if you are still hitting this issue?

@joeyorlando joeyorlando added awaiting input Awaiting input/answer from user responsible for the issue/PR and removed more info needed needs triage labels Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting input Awaiting input/answer from user responsible for the issue/PR bug Something isn't working part:alert flow & configuration
Projects
None yet
Development

No branches or pull requests

3 participants