-
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
Removing circular dependency between spaces and security #81891
Changes from 1 commit
255f0ba
d57da03
ea217a5
64f5cec
904ff08
26cecc5
d8a3392
5258acc
e974624
76538c7
0a4a045
d8c3de0
9c544f3
26074a7
0bd2896
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
*/ | ||
import type { PublicMethodsOf } from '@kbn/utility-types'; | ||
import { Dictionary, pickBy, mapValues, without, cloneDeep } from 'lodash'; | ||
import type { Request } from '@hapi/hapi'; | ||
import { Logger, KibanaRequest } from '../../../../../src/core/server'; | ||
import { TaskRunnerContext } from './task_runner_factory'; | ||
import { ConcreteTaskInstance, throwUnrecoverableError } from '../../../task_manager/server'; | ||
|
@@ -91,9 +92,10 @@ export class TaskRunner { | |
requestHeaders.authorization = `ApiKey ${apiKey}`; | ||
} | ||
|
||
return ({ | ||
const path = spaceId ? `/s/${spaceId}` : '/'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: same question about |
||
|
||
const fakeRequest = KibanaRequest.from(({ | ||
headers: requestHeaders, | ||
getBasePath: () => this.context.getBasePath(spaceId), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change looks wrong to me... but I'm not actually sure.
Perhaps @mikecote can help here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah we were using One of the reasons to fake a request was so that the Spaces plugin could properly scope instances of the Saved Objects client. Since we aren't honoring LP requests anymore, there isn't a need to provide the ^^^^^ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mikecote what are your thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If that is their recommendation for now, I'm ok with this change. Alerting is hacking fake requests in Kibana until scope-able elasticsearch clients is around so we'll have some odd code to deal with until then either way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case my review still stands, but on this specific question I'm relying on your understanding of this 😆 |
||
path: '/', | ||
route: { settings: {} }, | ||
url: { | ||
|
@@ -104,7 +106,11 @@ export class TaskRunner { | |
url: '/', | ||
}, | ||
}, | ||
} as unknown) as KibanaRequest; | ||
} as unknown) as Request); | ||
|
||
this.context.basePathService.set(fakeRequest, path); | ||
|
||
return fakeRequest; | ||
} | ||
|
||
private getServicesWithSpaceLevelPermissions( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: any reason why we cannot use already exported
addSpaceIdToPath
here (to leave/s/
logic to Spaces plugin)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I don't see why we can't use that