fix(integration): instead of throwing error console and return empty string on interpolation

This commit is contained in:
Akhil Mohan
2023-08-21 20:06:24 +05:30
parent e28ced8eed
commit b7aac1a465
+10 -9
View File
@@ -11,7 +11,7 @@ import {
IServiceTokenData, IServiceTokenData,
Secret, Secret,
SecretBlindIndexData, SecretBlindIndexData,
ServiceTokenData, ServiceTokenData
} from "../models"; } from "../models";
import { EventType, SecretVersion } from "../ee/models"; import { EventType, SecretVersion } from "../ee/models";
import { import {
@@ -395,7 +395,7 @@ export const createSecretHelper = async ({
algorithm: ALGORITHM_AES_256_GCM, algorithm: ALGORITHM_AES_256_GCM,
keyEncoding: ENCODING_SCHEME_UTF8 keyEncoding: ENCODING_SCHEME_UTF8
}).save(); }).save();
const secretVersion = new SecretVersion({ const secretVersion = new SecretVersion({
secret: secret._id, secret: secret._id,
version: secret.version, version: secret.version,
@@ -463,8 +463,8 @@ export const createSecretHelper = async ({
}); });
const postHogClient = await TelemetryService.getPostHogClient(); const postHogClient = await TelemetryService.getPostHogClient();
if (postHogClient && (metadata?.source !== "signup")) { if (postHogClient && metadata?.source !== "signup") {
postHogClient.capture({ postHogClient.capture({
event: "secrets added", event: "secrets added",
distinctId: await TelemetryService.getDistinctId({ distinctId: await TelemetryService.getDistinctId({
@@ -549,7 +549,7 @@ export const getSecretsHelper = async ({
channel: authData.userAgentType, channel: authData.userAgentType,
ipAddress: authData.ipAddress ipAddress: authData.ipAddress
})); }));
await EEAuditLogService.createAuditLog( await EEAuditLogService.createAuditLog(
authData, authData,
{ {
@@ -659,7 +659,7 @@ export const getSecretHelper = async ({
ipAddress: authData.ipAddress ipAddress: authData.ipAddress
})); }));
await EEAuditLogService.createAuditLog( await EEAuditLogService.createAuditLog(
authData, authData,
{ {
type: EventType.GET_SECRET, type: EventType.GET_SECRET,
@@ -824,8 +824,8 @@ export const updateSecretHelper = async ({
channel: authData.userAgentType, channel: authData.userAgentType,
ipAddress: authData.ipAddress ipAddress: authData.ipAddress
})); }));
await EEAuditLogService.createAuditLog( await EEAuditLogService.createAuditLog(
authData, authData,
{ {
type: EventType.UPDATE_SECRET, type: EventType.UPDATE_SECRET,
@@ -1088,7 +1088,8 @@ const recursivelyExpandSecret = async (
let interpolatedValue = interpolatedSec[key]; let interpolatedValue = interpolatedSec[key];
if (!interpolatedValue) { if (!interpolatedValue) {
throw new Error(`Couldn't find referenced value - ${key}`); console.error(`Couldn't find referenced value - ${key}`);
return "";
} }
const refs = interpolatedValue.match(INTERPOLATION_SYNTAX_REG); const refs = interpolatedValue.match(INTERPOLATION_SYNTAX_REG);