-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[usageCollection] /api/stats
endpoint throw errors for unauth users when asking for extended stats
#160385
Comments
Pinging @elastic/kibana-core (Team:Core) |
Note that @azasypkin checked, and we would be fine using the internal user for this call in term of permissions:
and |
Ihmo we would be fine using the internal user, given the only ES call that is performed is this In that case, I also think we should just always use the internal client (not only for unauth users), as it's less branching and divergence, and makes it easier to test. |
I agree. My only request would be to include an |
Just noting that this will be a blocker for autoscaling as it is preventing us from getting the metrics we need /cc @Bamieh It shouldn't prevent us from progressing on the kibana-controller work, but it will block us from testing the whole thing end-to-end. |
I just self-assigned the issue. Unless we missed something big, it should be trivial and addressed this week. We missed the |
No strong feelings on that; most important is getting it into |
…0520) ## Summary Fix #160385 Use the internal client instead of the scoped one for the extended stats ES requests to avoid an error with unauthenticated users (when anonymous access is allowed) --------- Co-authored-by: Kibana Machine <[email protected]>
(yeah, fairly long title)
The
/api/stats
endpoint from theusage_collection
pluginkibana/src/plugins/usage_collection/server/routes/stats/stats.ts
Lines 53 to 55 in 8a9789b
Can eventually accepts unauthenticated requests when the
status.allowAnonymous
config setting istrue
kibana/src/plugins/usage_collection/server/routes/stats/stats.ts
Lines 56 to 57 in 8a9789b
However, when asking for
extended
stats, the handler performs a request against ES using the es-scoped client:kibana/src/plugins/usage_collection/server/routes/stats/stats.ts
Lines 76 to 81 in 8a9789b
So when a unauthenticated user accesses the endpoint with the
extended: true
option, the request against ES fails, causing errors similar to:We should decide if it's fine to use the internal client instead of the user-scoped one for this call:
kibana/src/plugins/usage_collection/server/routes/stats/stats.ts
Lines 47 to 51 in 8a9789b
Otherwise, we should forbid to use the
extended
option for anonymous users and throw a more explicit error instead.cc @azasypkin @lukeelmers
The text was updated successfully, but these errors were encountered: