Heimdall: Path received via Envoy gRPC corrupted when containing query string
Description
Heimdall is a cloud native Identity Aware Proxy and Access Control Decision service. When using Heimdall in envoy gRPC decision API mode with versions 0.7.0-alpha through 0.17.10, wrong encoding of the query URL string allows rules with non-wildcard path expressions to be bypassed. Envoy splits the requested URL into parts, and sends the parts individually to Heimdall. Although query and path are present in the API, the query field is documented to be always empty and the URL query is included in the path field. The implementation uses go's url library to reconstruct the url which automatically encodes special characters in the path. As a consequence, a parameter like /mypath?foo=bar to Path is escaped into /mypath%3Ffoo=bar. Subsequently, a rule matching /mypath no longer matches and is bypassed. The issue can only lead to unintended access if Heimdall is configured with an "allow all" default rule. Since v0.16.0, Heimdall enforces secure defaults and refuses to start with such a configuration unless this enforcement is explicitly disabled, e.g. via --insecure-skip-secure-default-rule-enforcement or the broader --insecure flag. This issue has been fixed in version 0.17.11.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/dadrus/heimdallGo | >= 0.7.0-alpha, < 0.17.11 | 0.17.11 |
Affected products
1Patches
150321b3007dbfix: Split query from path in envoy gRPC based ExtAuth integration (#3106)
2 files changed · +21 −13
internal/handler/envoyextauth/grpcv3/request_context.go+8 −4 modified@@ -71,7 +71,6 @@ type RequestContext struct { hmdlReq *heimdall.Request // the following properties are created lazy and cached - savedBody any outputs map[string]any } @@ -103,16 +102,21 @@ func (r *RequestContext) Init(ctx context.Context, req *envoy_auth.CheckRequest) httpReq := req.GetAttributes().GetRequest().GetHttp() + parsed, err := url.ParseRequestURI(httpReq.GetPath()) + if err != nil { + parsed = &url.URL{} + } + r.ctx = ctx r.reqHeaders = canonicalizeHeaders(httpReq.GetHeaders()) r.reqRawBody = httpReq.GetRawBody() r.hmdlReq.Method = httpReq.GetMethod() r.hmdlReq.URL.URL = url.URL{ Scheme: httpReq.GetScheme(), Host: httpReq.GetHost(), - Path: httpReq.GetPath(), - RawQuery: httpReq.GetQuery(), - Fragment: httpReq.GetFragment(), + RawPath: parsed.RawPath, + Path: parsed.Path, + RawQuery: parsed.RawQuery, } r.hmdlReq.ClientIPAddresses = clientIPs }
internal/handler/envoyextauth/grpcv3/request_context_test.go+13 −9 modified@@ -41,9 +41,9 @@ func TestNewRequestContext(t *testing.T) { Method: http.MethodPatch, Scheme: "https", Host: "foo.bar:8080", - Path: "/test/baz", - Query: "bar=moo", - Fragment: "foobar", + Path: "/test/baz?bar=moo#foobar", + Query: "", // documented to be empty + Fragment: "", // documented to be empty Body: "content=heimdall", RawBody: []byte("content=heimdall"), Headers: map[string]string{ @@ -77,10 +77,10 @@ func TestNewRequestContext(t *testing.T) { require.Equal(t, httpReq.GetMethod(), ctx.Request().Method) require.Equal(t, httpReq.GetScheme(), ctx.Request().URL.Scheme) require.Equal(t, httpReq.GetHost(), ctx.Request().URL.Host) - require.Equal(t, httpReq.GetPath(), ctx.Request().URL.Path) - require.Equal(t, httpReq.GetFragment(), ctx.Request().URL.Fragment) - require.Equal(t, httpReq.GetQuery(), ctx.Request().URL.RawQuery) - require.Equal(t, "moo", ctx.Request().URL.Query().Get("bar")) + require.Equal(t, "/test/baz", ctx.Request().URL.Path) + require.Empty(t, ctx.Request().URL.Fragment) + require.Equal(t, "bar=moo#foobar", ctx.Request().URL.RawQuery) + require.Equal(t, "moo#foobar", ctx.Request().URL.URL.Query().Get("bar")) require.Equal(t, map[string]any{"content": []string{"heimdall"}}, ctx.Request().Body()) require.Len(t, ctx.Request().Headers(), 3) require.Equal(t, "barfoo", ctx.Request().Header("X-Foo-Bar")) @@ -330,7 +330,9 @@ func TestRequestContextBody(t *testing.T) { Attributes: &envoy_auth.AttributeContext{ Request: &envoy_auth.AttributeContext_Request{ Http: &envoy_auth.AttributeContext_HttpRequest{ - RawBody: tc.body, Headers: map[string]string{"content-type": tc.ct}, + Path: "/test", + RawBody: tc.body, + Headers: map[string]string{"content-type": tc.ct}, }, }, }, @@ -359,7 +361,9 @@ func TestRequestContextRequestURLCaptures(t *testing.T) { Attributes: &envoy_auth.AttributeContext{ Request: &envoy_auth.AttributeContext_Request{ Http: &envoy_auth.AttributeContext_HttpRequest{ - RawBody: []byte("foo"), Headers: map[string]string{"content-type": "application/json"}, + Path: "/test", + RawBody: []byte("foo"), + Headers: map[string]string{"content-type": "application/json"}, }, }, },
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-r8x2-fhmf-6mxpghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-32811ghsaADVISORY
- github.com/dadrus/heimdall/commit/50321b3007db1ccafdc6b1cfd6bdc3689c19a502ghsax_refsource_MISCWEB
- github.com/dadrus/heimdall/pull/3106ghsax_refsource_MISCWEB
- github.com/dadrus/heimdall/security/advisories/GHSA-r8x2-fhmf-6mxpghsax_refsource_CONFIRMWEB
- github.com/envoyproxy/envoy/blob/105b4acd422d67fcff908ec38d91c7676d079939/api/envoy/service/auth/v3/attribute_context.protoghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.