prometheus / prometheus/alertmanager

Backslash in label value is not properly url-decoded

Open
#4,804 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/ui
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

What did you do?

When creating a silence that contains a label value ending with a Windows path (e.g., E:), the Alertmanager UI incorrectly handles the backslash.

Example filter:

{volume_mount_point="E:\"}

After url decoding, Alertmanager treats the trailing backslash as an invalid escape sequence and fails to parse the label selector.

What did you expect to see?

Alertmanager UI should properly escape backslashes when constructing or decoding silence URLs.

Example:

volume_mount_point="E:\\" should be encoded in URL as E:%5C%5C and decoded back into a valid label selector instead of causing an parsing error.

What did you see instead? Under which circumstances?

The UI decodes E:%5C into E:\ but the backslash is not properly escaped, resulting in: volume_mount_point="E:\"

This causes the silence creation page to fail to load the selector.

Image Image

Link:

https://infra-prom-alert.ipt.inventec.net/#/silences/new?filter=%7Balertname%3D%22MSSQLNotHealthDisks%22%2C%20instance%3D%22mssql-exporter%3A9273%22%2C%20job%3D%22mssql%22%2C%20measurement_db_type%3D%22SQLServer%22%2C%20server_name%3D%22IPT-F3FISDB%22%2C%20severity%3D%22red%22%2C%20sql_instance%3D%22IPT-F3FISDB%22%2C%20volume_mount_point%3D%22E%3A%5C%22%7D
System information

No response

Alertmanager version
alertmanager, version 0.28.1 (branch: HEAD, revision: b2099eaa2c9ebc25edb26517cb9c732738e93910)
  build user:       root@fa3ca569dfe4
  build date:       20250307-15:05:18
  go version:       go1.23.7
  platform:         linux/amd64
  tags:             netgo
Alertmanager configuration file

Prometheus version

Prometheus configuration file

Logs

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Alertmanager UI silence-creation page and trace how the filter query parameter is URL-decoded into a label selector. Reproduce the trailing Windows-path backslash case from the issue, then locate the relevant UI test or parsing test and add coverage for the encoded value. Done means the page loads the selector and preserves the escaped backslash without a parsing error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.