Compare commits

..

3 Commits

Author SHA1 Message Date
4a153e5658 Merge pull request #1295 from akhilmhdh/fix/sec-interpolation-undefined
fix(secret-reference): fixed undefined if value not found
2024-01-10 09:59:09 -05:00
7324822be5 fix(secret-reference): fixed undefined if value not found 2024-01-10 11:45:46 +05:30
766f301aea patch agent config by env 2024-01-09 14:30:29 -05:00
5 changed files with 29 additions and 22 deletions

View File

@ -579,7 +579,9 @@ export const getSecretsHelper = async ({
event: "secrets pulled",
distinctId: await TelemetryService.getDistinctId({ authData }),
properties: {
numberOfSecrets: shouldRecordK8Event ? approximateForNoneCapturedEvents : secrets.length,
numberOfSecrets: shouldRecordK8Event
? approximateForNoneCapturedEvents
: secrets.length,
environment,
workspaceId,
folderId,
@ -614,7 +616,6 @@ export const getSecretHelper = async ({
include_imports = true,
version
}: GetSecretParams) => {
const secretBlindIndex = await generateSecretBlindIndexHelper({
secretName,
workspaceId: new Types.ObjectId(workspaceId)
@ -644,7 +645,7 @@ export const getSecretHelper = async ({
type: type ?? SECRET_PERSONAL,
version
}).lean();
if (secretVersion) {
secret = await new Secret({
...secretVersion,
@ -673,7 +674,7 @@ export const getSecretHelper = async ({
type: SECRET_SHARED,
version
}).lean();
if (secretVersion) {
secret = await new Secret({
...secretVersion,
@ -682,10 +683,16 @@ export const getSecretHelper = async ({
}
}
}
if (!secret && include_imports) {
// if still no secret found search in imported secret and retreive
secret = await getAnImportedSecret(secretName, workspaceId.toString(), environment, folderId, version);
secret = await getAnImportedSecret(
secretName,
workspaceId.toString(),
environment,
folderId,
version
);
}
if (!secret) throw SecretNotFoundError();
@ -1180,11 +1187,12 @@ const recursivelyExpandSecret = async (
const secRefKey = entities[entities.length - 1];
const val = await fetchCrossEnv(secRefEnv, secRefPath, secRefKey);
interpolatedValue = interpolatedValue.replaceAll(interpolationSyntax, val);
if (val !== undefined) {
interpolatedValue = interpolatedValue.replaceAll(interpolationSyntax, val);
}
}
}
}
expandedSec[key] = interpolatedValue;
return interpolatedValue;
};

View File

@ -498,7 +498,7 @@ var agentCmd = &cobra.Command{
agentConfigInBase64 := os.Getenv("INFISICAL_AGENT_CONFIG_BASE64")
if configPath != "" {
if agentConfigInBase64 == "" {
data, err := ioutil.ReadFile(configPath)
if err != nil {
if !FileExists(configPath) {
@ -506,7 +506,6 @@ var agentCmd = &cobra.Command{
return
}
}
agentConfigInBytes = data
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

View File

@ -70,7 +70,7 @@ export const AdminLayout = ({ children }: LayoutProps) => {
const { user } = useUser();
const { subscription } = useSubscription();
const { data: updateClosed } = useGetUserAction("december_update_closed");
const { data: updateClosed } = useGetUserAction("september_update_closed");
const infisicalPlatformVersion = process.env.NEXT_PUBLIC_INFISICAL_PLATFORM_VERSION;
const { t } = useTranslation();
@ -78,7 +78,7 @@ export const AdminLayout = ({ children }: LayoutProps) => {
const registerUserAction = useRegisterUserAction();
const closeUpdate = async () => {
await registerUserAction.mutateAsync("december_update_closed");
await registerUserAction.mutateAsync("september_update_closed");
};
const logout = useLogoutUser();
@ -182,14 +182,14 @@ export const AdminLayout = ({ children }: LayoutProps) => {
} relative z-10 mb-6 flex pb-2 w-52 flex-col items-center justify-start rounded-md border border-mineshaft-600 bg-mineshaft-900 px-3`}
>
<div className="text-md mt-2 w-full font-semibold text-mineshaft-100">
Infisical December update
Infisical September update
</div>
<div className="mt-1 mb-1 w-full text-sm font-normal leading-[1.2rem] text-mineshaft-300">
Infisical Agent, new SDKs, Machine Identities, and more!
Improved RBAC, new integrations, dashboard remake, and more!
</div>
<div className="mt-2 h-[6.77rem] w-full rounded-md border border-mineshaft-700">
<Image
src="/images/infisical-update-december-2023.png"
src="/images/infisical-update-september-2023.png"
height={319}
width={539}
alt="kubernetes image"
@ -205,7 +205,7 @@ export const AdminLayout = ({ children }: LayoutProps) => {
Close
</button>
<a
href="https://infisical.com/blog/infisical-update-december-2023"
href="https://infisical.com/blog/infisical-update-september-2023"
target="_blank"
rel="noopener noreferrer"
className="text-sm font-normal leading-[1.2rem] text-mineshaft-400 duration-200 hover:text-mineshaft-100"

View File

@ -121,7 +121,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
const { user } = useUser();
const { subscription } = useSubscription();
const workspaceId = currentWorkspace?._id || "";
const { data: updateClosed } = useGetUserAction("december_update_closed");
const { data: updateClosed } = useGetUserAction("september_update_closed");
const { data: secretApprovalReqCount } = useGetSecretApprovalRequestCount({ workspaceId });
@ -153,7 +153,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
const registerUserAction = useRegisterUserAction();
const closeUpdate = async () => {
await registerUserAction.mutateAsync("december_update_closed");
await registerUserAction.mutateAsync("september_update_closed");
};
const logout = useLogoutUser();
@ -646,14 +646,14 @@ export const AppLayout = ({ children }: LayoutProps) => {
} relative z-10 mb-6 flex h-64 w-52 flex-col items-center justify-start rounded-md border border-mineshaft-600 bg-mineshaft-900 px-3`}
>
<div className="text-md mt-2 w-full font-semibold text-mineshaft-100">
Infisical December update
Infisical September update
</div>
<div className="mt-1 mb-1 w-full text-sm font-normal leading-[1.2rem] text-mineshaft-300">
Infisical Agent, new SDKs, Machine Identities, and more!
Improved RBAC, new integrations, dashboard remake, and more!
</div>
<div className="mt-2 h-[6.77rem] w-full rounded-md border border-mineshaft-700">
<Image
src="/images/infisical-update-december-2023.png"
src="/images/infisical-update-september-2023.png"
height={319}
width={539}
alt="kubernetes image"
@ -669,7 +669,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
Close
</button>
<a
href="https://infisical.com/blog/infisical-update-december-2023"
href="https://infisical.com/blog/infisical-update-september-2023"
target="_blank"
rel="noopener noreferrer"
className="text-sm font-normal leading-[1.2rem] text-mineshaft-400 duration-200 hover:text-mineshaft-100"