[Synthetics] Only allow params to be saved against specific namespaces (#155948)

## Summary

We had an issue backporting some changes in a previous patch, and some
of the code from the update did not make it into 8.7. This PR introduces
a commit that did not fully merge.

Co-authored-by: shahzad31 <shahzad31comp@gmail.com>
This commit is contained in:
Justin Kambic 2023-04-26 17:49:27 -04:00 committed by GitHub
parent 167c3285d8
commit 40546954e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -473,7 +473,7 @@ export class SyntheticsService {
async getSyntheticsParams({ spaceId }: { spaceId?: string } = {}) {
const encryptedClient = this.server.encryptedSavedObjects.getClient();
const paramsBySpace: Record<string, Record<string, string>> = {};
const paramsBySpace: Record<string, Record<string, string>> = Object.create(null);
const finder =
await encryptedClient.createPointInTimeFinderDecryptedAsInternalUser<SyntheticsParamSO>({
@ -486,7 +486,7 @@ export class SyntheticsService {
response.saved_objects.forEach((param) => {
param.namespaces?.forEach((namespace) => {
if (!paramsBySpace[namespace]) {
paramsBySpace[namespace] = {};
paramsBySpace[namespace] = Object.create(null);
}
paramsBySpace[namespace][param.attributes.key] = param.attributes.value;
});