Hidden-field restrictions are dropped when a request repeats the parameter
perfloop-oss/victoriatraces · Unclassified
https://perfloop.ai/t/oss/case_xs08q5jsdc
Verdict
VERIFIED · settled 2026-11-23
What happened: The check fails before this change and passes with it.
Hypothesis
VictoriaTraces lets a deployment hide sensitive span attributes by attaching `hidden_fields_filters` to query requests, for example from an auth proxy. Both request parsers that read that argument keep only the first value the request supplies, so an added value placed ahead of the enforced one replaces the whole restriction instead of adding to it. Whether a deployed proxy inserts its value after a caller-supplied duplicate is unmeasured; the request-level behavior is confirmed by the check below.
`app/vtselect/traces/tracecommon/tracecommon.go:getStringSliceFromRequest` (lines 100-118) calls `r.FormValue(argName)`, which returns only the first entry of `r.Form[argName]` and silently discards the rest. It is reached on the assigned workload by `jaeger.processGetTraceRequest` (jaeger.go:137-204, call at line 138) -> `tracecommon.GetCommonParams` (tracecommon.go:74-98, call at line 81), and the Jaeger handler routes by path only, so a POST reaches it as well as a GET. `app/vtselect/logsql/logsql.go:getStringSliceFromRequest` (1806-1824) is the same code, used for the same argument by `parseCommonArgs` at line 1604. The parsers that feed `extra_filters` / `extra_stream_filters` (logsql.go:1569-1585) instead loop over `r.Form[...]` and keep every value, so `hidden_fields_filters` is the one parsed argument where a later value is lost.
A synthetic check with invented field names asserts that every supplied restriction survives, covering the formats the docs list. `go test ./app/vtselect/traces/tracecommon/ -run TestGetStringSliceFromRequestKeepsEveryValue -count=1` (new file `zz_preserve_probe_test.go`) fails on the current code in three subtests: a GET with `hidden_fields_filters=span_attr:none&hidden_fields_filters=span_attr:secret` yields only `["span_attr:none"]`; a POST form body `hidden_fields_filters=span_attr:none` shadows the query-arg `span_attr:secret` and yields only the body value; and a JSON-array value followed by a comma-separated value yields only the array. A temporary experimental edit that parsed the form and appended every value (expanding JSON arrays, splitting comma lists) made the same test pass; that edit was reverted and is not part of the accepted revision.
The parsed list is load-bearing: `tracecommon.CommonParams.NewQueryContext` (line 66) passes `HiddenFieldsFilters` to `logstorage.NewQueryContext`, and the vendored `getSearchOptions` turns a non-empty list into deny filters (vendor/github.com/VictoriaMetrics/VictoriaLogs/lib/logstorage/storage_search.go:253-257), so an entry that is dropped means those span attributes come back unmodified in the Jaeger response. `docs/victoriatraces/querying/README.md:289-296` documents the argument as the way to restrict sensitive span attributes and says an auth proxy such as vmauth can attach it. The repository does not contain vmauth, so append-versus-replace semantics at the proxy, deployment prevalence and any real disclosure remain Case investigation questions; no deployed-system behavior has been observed.
Open PR https://github.com/VictoriaMetrics/VictoriaTraces/pull/184 (head 18d19f5446139d01b646fd66aa31bbeeaed474d3) and its linked issue https://github.com/VictoriaMetrics/VictoriaTraces/issues/178 change `extra_filters` handling in the Jaeger/Tempo query parsers; the implementation inspected there leaves this helper's first-value behavior unchanged, so this report is distinct. Merged-history review is a gap: this checkout has a single commit and bounded upstream commit-history reads were refused.
The submitter's report asks for both parser repairs, for combining all JSON-array and comma-separated entries across query and form parameters as `extra_filters` already does, and for unit tests covering repeated query parameters and POST form precedence; the smallest useful next check is the failing test above, kept fail-closed so a restriction added by another party cannot be removed by the caller.
Change to test: Combine every supplied value of the hidden-fields argument instead of taking the first, in both the traces and LogsQL parsers, keeping the existing comma-separated and JSON-array formats, so a value a caller adds can only narrow the result. Add unit tests for repeated query parameters and POST form precedence.
Where it lives
perfloop-oss/victoriatraces · app/vtselect/traces/jaeger/jaeger.go
Evidence
The check fails before this change and passes with it: `tracecommon.GetCommonParams parses every hidden_fields_filters value from the request query string and from the urlencoded or multipart request body with the documented comma-separated and JSON-array formats and combines them into CommonParams.HiddenFieldsFilters, so a repeated arg or a body value cannot drop a restriction supplied by another value; empty values add no restriction and an invalid value makes the request fail.`
The check fails before this change and passes with it: `logsql.parseCommonArgs parses every hidden_fields_filters value from the request query string and from the urlencoded request body with the documented comma-separated and JSON-array formats and combines them into commonArgs.hiddenFieldsFilters, so a repeated arg or a body value cannot drop a restriction supplied by another value; empty values add no restriction and an invalid value makes the request fail.`
Checks: 3 of 3 passed. Verification: no defect found.
Timeline
2026-11-22· Case opened