You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[surfacers.prometheus] Sanitize label values before exposing them #975
This is particularly a problem for external and browser probes where we don't control label values. We should do this in prometheus surfacer. From official documentation:
label_value can be any sequence of UTF-8 characters, but the backslash (\), double-quote ("), and line feed (\n) characters have to be escaped as \\, \", and \n, respectively.
Note that after #976 merge, it should be less of an issue. Labels are generated in one of the following ways:
Added by us: probe, dst, etc.
Configured by the user through additional_labels
Parsed from the probe output.
It's only the last one (3rd) that has caused issues so far. 1st and 2nd options can get spurious values if one deliberately adds such value, e.g. bad probe name.
Activity
manugarg commentedon Jan 25, 2025
We should sanitize label values within browser probe reporter as well, e.g.
cloudprober/probes/browser/templates/cloudprober-reporter.ts.tmpl
Lines 54 to 55 in d8d43a1
for example, a test title -- "do x, then y", will end up being parsed as {test=""do x", because of the bug here: #951.
manugarg commentedon Jan 26, 2025
#976 fixes the underlying line parsing problem.
manugarg commentedon Jan 27, 2025
Note that after #976 merge, it should be less of an issue. Labels are generated in one of the following ways:
It's only the last one (3rd) that has caused issues so far. 1st and 2nd options can get spurious values if one deliberately adds such value, e.g. bad probe name.
manugarg commentedon Jan 29, 2025
Since the main problem is fixed, it's really hard to get tripped by it. Marking it as enhancement.