Skip to content

Commit

Permalink
Default to internal for fake requests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Jul 31, 2020
1 parent 7ee769f commit 4eb455d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/server/http/router/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,12 @@ export class KibanaRequest<
// until that time we have to expose all the headers
private readonly withoutSecretHeaders: boolean
) {
this.id = (request.app as KibanaRequestState).requestId;
// The `requestId` property will not be populated for requests that are 'faked' by internal systems that leverage
// KibanaRequest in conjunction with scoped Elaticcsearch and SavedObjectsClient in order to pass credentials.
// In these cases, the id defaults to `internal`.
// This should be solved as part of https://github.com/elastic/kibana/issues/39430.
this.id = (request.app as KibanaRequestState | undefined)?.requestId ?? 'internal';

this.url = request.url;
this.headers = deepFreeze({ ...request.headers });
this.isSystemRequest =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const buildRequest = (path = '/app/kibana') => {
const get = sinon.stub();

return {
app: {},
path,
route: { settings: {} },
headers: {},
Expand Down

0 comments on commit 4eb455d

Please sign in to comment.