Bug: Fix tag values handling with special characters#6212
Merged
joe-elliott merged 9 commits intografana:mainfrom Jan 15, 2026
Merged
Bug: Fix tag values handling with special characters#6212joe-elliott merged 9 commits intografana:mainfrom
joe-elliott merged 9 commits intografana:mainfrom
Conversation
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
c7bd4cc to
d1dccfa
Compare
| } | ||
|
|
||
| // the use of path.Join, not escaping the key and the specific way the url is parsed is all very purposeful here | ||
| // to mimic how Grafana builds URLs when calling Tempo so our integration tests mimic our most important client |
Contributor
There was a problem hiding this comment.
This is rather unfortunate
| tagNameRegexV1 = regexp.MustCompile(`.*/api/search/tag/([^/]+)/values`) | ||
| tagNameRegexV2 = regexp.MustCompile(`.*/api/v2/search/tag/([^/]+)/values`) | ||
| tagNameRegexV1 = regexp.MustCompile(`.*/api/search/tag/(.+)/values`) | ||
| tagNameRegexV2 = regexp.MustCompile(`.*/api/v2/search/tag/(.+)/values`) |
Contributor
There was a problem hiding this comment.
What if I construct an attribute with key=maliciousAttribute/api/search/tag/?
oleg-kozlyuk-grafana
approved these changes
Jan 14, 2026
Contributor
oleg-kozlyuk-grafana
left a comment
There was a problem hiding this comment.
I appreciate that there are layers of legacy behaviors here that are hard to untangle. Ideally, of course, regex should be eliminated - but the ROI on this effort would be too low.
Signed-off-by: Joe Elliott <number101010@gmail.com>
3 tasks
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.
What this PR does:
Tempo doesn't handle tag value lookups when special characters are present in the tag value very well. This PR adds support for special characters and adds an integration test to pin this behavior. There are some ticky-tacky changes in this PR to tag path parsing but the integration test should hold everything in place.
Also changed our http client to mimic the way Grafana builds urls when calling Tempo. This will help keep our integration tests "honest" with our most important client. See the integration tests and http client changes for details.
Finally, I was not able to find a solution for attributes containing a double forward slash
//. The router itself seemed to eat one of the slashes and normalize the path to only have one. This will require more digging.Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]