Skip to content
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

[App services] Permission errors logged when opening Kibana for the first time #95094

Closed
wylieconlon opened this issue Mar 22, 2021 · 4 comments
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Data Views Data Views code and UI - index patterns before 8.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort SharedUX/fix-it-week Bugs that have been groomed and queued up for the team's next fix it week

Comments

@wylieconlon
Copy link
Contributor

This is happening on the main branch as of today.

Steps to reproduce:

  1. Open Kibana in an incognito window
  2. See the following errors in the console:
server    log   [14:51:20.085] [error][data][data][indexPatterns][plugins] ResponseError: security_exception
    at onBody (kibana/node_modules/@elastic/elasticsearch/lib/Transport.js:333:23)
    at IncomingMessage.onEnd (kibana/node_modules/@elastic/elasticsearch/lib/Transport.js:260:11)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  meta: {
    body: { error: [Object], status: 401 },
    statusCode: 401,
    headers: {
      'x-opaque-id': '89f382ce-6825-453a-8bb5-1664d97b630e',
      'www-authenticate': 'Basic realm="security" charset="UTF-8"',
      'content-type': 'application/json;charset=utf-8',
      'content-length': '441'
    },
    meta: {
      context: null,
      request: [Object],
      name: 'elasticsearch-js',
      connection: [Object],
      attempts: 0,
      aborted: false
    }
  },
  isBoom: true,
  isServer: true,
  data: null,
  output: {
    statusCode: 500,
    payload: {
      statusCode: 500,
      error: 'Internal Server Error',
      message: 'An internal server error occurred'
    },
    headers: {}
  },
  [Symbol(SavedObjectsClientErrorCode)]: 'SavedObjectsClient/generalError'
}
@wylieconlon wylieconlon added bug Fixes for quality problems that affect the customer experience Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! labels Mar 22, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@legrego legrego added Team:AppServices and removed Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! labels Mar 22, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@legrego
Copy link
Member

legrego commented Mar 22, 2021

Discussed offline, and this appears to be a faulty Route Handler Context:

core.http.registerRouteHandlerContext<DataRequestHandlerContext, 'indexPatterns'>(
'indexPatterns',
async (context, request) => {
const [coreStart, , dataStart] = await core.getStartServices();
try {
return await dataStart.indexPatterns.indexPatternsServiceFactory(
coreStart.savedObjects.getScopedClient(request),
coreStart.elasticsearch.client.asScoped(request).asCurrentUser
);
} catch (e) {
logger.error(e);
return undefined;
}
}
);

These context providers execute on every inbound http request to the Kibana server, so they should be kept as performant as possible.

This particular provider is querying the UI Settings Service to retrieve personalized settings required for index patterns. There are a couple of problems with this approach:

  1. This runs on every request, including those on unauthenticated pages such as the login screen. It's not possible to use the UI Settings service without an authenticated user (assuming security is enabled).
  2. I expect this context provider is only used by a handful of routes. That means we are doing a lot of work that will be thrown away on every other http request that Kibana has to handle.

I think this context handler should be revisited so that it does not attempt to communicate with ES at all unless explicitly requested by a consumer.

@wylieconlon wylieconlon changed the title [Kibana security] Permission errors logged when opening Kibana for the first time [App services] Permission errors logged when opening Kibana for the first time Mar 22, 2021
@wylieconlon wylieconlon added the Feature:Data Views Data Views code and UI - index patterns before 8.0 label Mar 22, 2021
@mattkime mattkime self-assigned this Mar 22, 2021
@Dosant Dosant added SharedUX/fix-it-week Bugs that have been groomed and queued up for the team's next fix it week impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort triaged labels Apr 22, 2021
@Dosant
Copy link
Contributor

Dosant commented May 4, 2021

No longer happening because the pr that introduced this was reverted #95335 (cc @lizozom fyi about the route context: #95094 (comment))

@Dosant Dosant closed this as completed May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Data Views Data Views code and UI - index patterns before 8.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort SharedUX/fix-it-week Bugs that have been groomed and queued up for the team's next fix it week
Projects
None yet
Development

No branches or pull requests

5 participants