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
A Flux request is constructed to query a bucket named BUCKET for organization ORG-02 and USER-2 using a valid token for for this user / org, however, data for ORG-01 is returned.
Notes
A flux request is handled by the http.FluxService, which requires a server address and a valid token
A http.QueryRequest struct is constructed, containing the Flux query and most importantly OrgID
The http.QueryRequest is transformed into a *query.ProxyRequest via the ProxyRequest API, which correctly transfers the OrgIDhere
A flux query is executed as a HTTP request via the FluxService.Query API using the ProxyRequest
The FluxService.Query API transforms the ProxyRequest back to a QueryRequest via the QueryRequestFromProxyRequest API
The http.QueryRequest is then serialized to JSON and POSTed to the server
The server handles the request via the FluxHandler.handleQuery HTTP handler
Within the handler, it decodes the incoming request via the decodeProxyQueryRequest API which calls decodeQueryRequest
Given the request mime type is application/json, it is decoded as such, however, the Org organization ID specified in the original request is overwritten by this line, which calls queryOrganization
queryOrganization attempts to retrieve the organization via the *http.Request object by inspecting the URL and looking first for a query parameter named orgID (which is not set). Secondly it attempts to find an org using a filter from the org parameter (also not set) and appears to return the first matching organization
It finds the first org created and allows the request to proceed
Because the buckets are named the same for two independent orgs, the query proceeds and returns invalid data
The text was updated successfully, but these errors were encountered:
The following end-to-end unit test fails as a result:
influxdb/cmd/influxd/launcher/storage_test.go
Lines 15 to 50 in 7f8e2c6
Setup
Two organizations are created:
and
A Flux request is constructed to query a bucket named
BUCKET
for organizationORG-02
andUSER-2
using a valid token for for this user / org, however, data forORG-01
is returned.Notes
http.FluxService
, which requires a server address and a valid tokenhttp.QueryRequest
struct is constructed, containing the Flux query and most importantlyOrgID
http.QueryRequest
is transformed into a*query.ProxyRequest
via theProxyRequest
API, which correctly transfers theOrgID
hereFluxService.Query
API using theProxyRequest
FluxService.Query
API transforms theProxyRequest
back to aQueryRequest
via theQueryRequestFromProxyRequest
APIQueryRequestFromProxyRequest
fails to transfer theOrgID
back from the innerRequest
structAssuming this is resolved
http.QueryRequest
is then serialized to JSON and POSTed to the serverFluxHandler.handleQuery
HTTP handlerdecodeProxyQueryRequest
API which callsdecodeQueryRequest
application/json
, it is decoded as such, however, theOrg
organization ID specified in the original request is overwritten by this line, which callsqueryOrganization
queryOrganization
attempts to retrieve the organization via the*http.Request
object by inspecting the URL and looking first for a query parameter namedorgID
(which is not set). Secondly it attempts to find an org using a filter from theorg
parameter (also not set) and appears to return the first matching organizationThe text was updated successfully, but these errors were encountered: