diff --git a/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts b/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts index 96e41fee021a2..d925f443873e4 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts @@ -5,7 +5,7 @@ * 2.0. */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { load } from 'js-yaml'; +import { safeLoad } from 'js-yaml'; import { Environment, FileSystemLoader } from 'nunjucks'; import { join as joinPath } from 'path'; import type { EcsMappingState } from '../../types'; @@ -185,6 +185,6 @@ export function createPipeline(state: EcsMappingState): IngestPipeline { }); const template = env.getTemplate('pipeline.yml.njk'); const renderedTemplate = template.render(mappedValues); - const ingestPipeline = load(renderedTemplate) as IngestPipeline; + const ingestPipeline = safeLoad(renderedTemplate) as IngestPipeline; return ingestPipeline; } diff --git a/x-pack/plugins/integration_assistant/server/integration_builder/pipeline.ts b/x-pack/plugins/integration_assistant/server/integration_builder/pipeline.ts index d733fd001be02..2cb22e4dfa8ab 100644 --- a/x-pack/plugins/integration_assistant/server/integration_builder/pipeline.ts +++ b/x-pack/plugins/integration_assistant/server/integration_builder/pipeline.ts @@ -11,6 +11,6 @@ import { createSync } from '../util'; export function createPipeline(specificDataStreamDir: string, pipeline: object): void { const filePath = joinPath(specificDataStreamDir, 'elasticsearch/ingest_pipeline/default.yml'); - const yamlContent = `---\n${yaml.dump(pipeline, { sortKeys: false })}`; + const yamlContent = `---\n${yaml.safeDump(pipeline, { sortKeys: false })}`; createSync(filePath, yamlContent); } diff --git a/x-pack/plugins/integration_assistant/server/util/processors.ts b/x-pack/plugins/integration_assistant/server/util/processors.ts index bfd544ec1182d..ad0ce1eec1f07 100644 --- a/x-pack/plugins/integration_assistant/server/util/processors.ts +++ b/x-pack/plugins/integration_assistant/server/util/processors.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { load } from 'js-yaml'; +import { safeLoad } from 'js-yaml'; import { join as joinPath } from 'path'; import { Environment, FileSystemLoader } from 'nunjucks'; import { deepCopy } from './util'; @@ -43,6 +43,6 @@ function createAppendProcessors(processors: SimplifiedProcessors): ESProcessorIt }); const template = env.getTemplate('append.yml.njk'); const renderedTemplate = template.render({ processors }); - const appendProcessors = load(renderedTemplate) as ESProcessorItem[]; + const appendProcessors = safeLoad(renderedTemplate) as ESProcessorItem[]; return appendProcessors; } diff --git a/x-pack/plugins/integration_assistant/server/util/samples.ts b/x-pack/plugins/integration_assistant/server/util/samples.ts index 8b306213fd3fd..e8489d79cdca0 100644 --- a/x-pack/plugins/integration_assistant/server/util/samples.ts +++ b/x-pack/plugins/integration_assistant/server/util/samples.ts @@ -203,5 +203,5 @@ export function generateFields(mergedDocs: string): string { .filter((key) => !ecsTopKeysSet.has(key)) .map((key) => recursiveParse(doc[key], [key])); - return yaml.dump(fieldsStructure, { sortKeys: false }); + return yaml.safeDump(fieldsStructure, { sortKeys: false }); }