diff --git a/x-pack/plugins/fleet/server/services/secrets.test.ts b/x-pack/plugins/fleet/server/services/secrets.test.ts index 8e92836e3fbf4..729c74a3ddec0 100644 --- a/x-pack/plugins/fleet/server/services/secrets.test.ts +++ b/x-pack/plugins/fleet/server/services/secrets.test.ts @@ -1018,9 +1018,11 @@ describe('secrets', () => { it('returns single secret reference for required secret', async () => { const mockPackagePolicy = { vars: { - 'pkg-secret-1': { - value: 'pkg-secret-1-val', + 'pkg-secret-1': {}, + 'pkg-secret-2': { + value: 'pkg-secret-2-val', }, + 'dot-notation.stream.pkg-secret-3': {}, }, inputs: [], } as unknown as NewPackagePolicy; @@ -1198,6 +1200,7 @@ describe('secrets', () => { value: 'pkg-secret-1-val', }, 'pkg-secret-2': {}, + 'dot-notation.pkg-secret-3': {}, }, inputs: [], } as unknown as PackagePolicy; diff --git a/x-pack/plugins/fleet/server/services/secrets.ts b/x-pack/plugins/fleet/server/services/secrets.ts index 6f50b2cd8b73b..c01c64e37e59e 100644 --- a/x-pack/plugins/fleet/server/services/secrets.ts +++ b/x-pack/plugins/fleet/server/services/secrets.ts @@ -241,7 +241,11 @@ export async function extractAndWriteSecrets(opts: { values: secretsToCreate.map((secretPath) => secretPath.value.value), }); - const policyWithSecretRefs = getPolicyWithSecretReferences(secretPaths, secrets, packagePolicy); + const policyWithSecretRefs = getPolicyWithSecretReferences( + secretsToCreate, + secrets, + packagePolicy + ); return { packagePolicy: policyWithSecretRefs,