Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix region in IAMClient

Tre Dubrava285bdc117db0
diff --git a/backend/src/ee/services/secret-rotation-v2/aws-iam-user-secret/aws-iam-user-secret-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/aws-iam-user-secret/aws-iam-user-secret-rotation-fns.ts
index e5f1a8185d..d3b8572b60 100644
--- a/backend/src/ee/services/secret-rotation-v2/aws-iam-user-secret/aws-iam-user-secret-rotation-fns.ts
+++ b/backend/src/ee/services/secret-rotation-v2/aws-iam-user-secret/aws-iam-user-secret-rotation-fns.ts
@@ -35,7 +35,7 @@ export const awsIamUserSecretRotationFactory: TRotationFactory<
const $rotateClientSecret = async () => {
const { credentials } = await getAwsConnectionConfig(connection, region);
- const iam = new IAMClient({ credentials });
+ const iam = new IAMClient({ credentials, region });
const { AccessKeyMetadata } = await iam.send(new ListAccessKeysCommand({ UserName: userName }));
@@ -60,8 +60,8 @@ export const awsIamUserSecretRotationFactory: TRotationFactory<
const { AccessKey } = await iam.send(new CreateAccessKeyCommand({ UserName: userName }));
return {
- accessKeyId: AccessKey!.AccessKeyId!,
- secretAccessKey: AccessKey!.SecretAccessKey!
+ accessKeyId: AccessKey?.AccessKeyId ?? "",
+ secretAccessKey: AccessKey?.SecretAccessKey ?? ""
};
};
@@ -78,7 +78,7 @@ export const awsIamUserSecretRotationFactory: TRotationFactory<
callback
) => {
const { credentials } = await getAwsConnectionConfig(connection, region);
- const iam = new IAMClient({ credentials });
+ const iam = new IAMClient({ credentials, region });
await Promise.all(
generatedCredentials.map((generatedCredential) =>
diff --git a/backend/src/server/routes/v1/app-connection-routers/aws-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/aws-connection-router.ts
index 69bf20e7ba..4dc0abf38a 100644
--- a/backend/src/server/routes/v1/app-connection-routers/aws-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/aws-connection-router.ts
@@ -76,8 +76,8 @@ export const registerAwsConnectionRouter = async (server: FastifyZodProvider) =>
200: z.object({
iamUsers: z
.object({
- UserName: z.string().optional(),
- Arn: z.string().optional()
+ UserName: z.string(),
+ Arn: z.string()
})
.array()
})
@@ -94,7 +94,12 @@ export const registerAwsConnectionRouter = async (server: FastifyZodProvider) =>
req.permission
);
- return { iamUsers };
+ return {
+ iamUsers: iamUsers.map((user) => ({
+ UserName: user.UserName ?? "",
+ Arn: user.Arn ?? ""
+ }))
+ };
}
});
};
diff --git a/backend/src/services/app-connection/aws/aws-connection-service.ts b/backend/src/services/app-connection/aws/aws-connection-service.ts
index 0d24f9b0fa..4d4ef10ff5 100644
--- a/backend/src/services/app-connection/aws/aws-connection-service.ts
+++ b/backend/src/services/app-connection/aws/aws-connection-service.ts
@@ -89,9 +89,9 @@ const listAwsKmsKeys = async (
};
const listAwsIamUsers = async (appConnection: TAwsConnection) => {
- const { credentials } = await getAwsConnectionConfig(appConnection);
+ const { region, credentials } = await getAwsConnectionConfig(appConnection);
- const iam = new IAMClient({ credentials });
+ const iam = new IAMClient({ credentials, region });
const userEntries: User[] = [];
let userMarker: string | undefined;
diff --git a/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-fns.ts b/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-fns.ts
index a69b54236c..695640f52b 100644
--- a/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-fns.ts
+++ b/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-fns.ts
@@ -217,8 +217,9 @@ const getParameterStoreTagsRecord = async (
})
);
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
- awsParameterStoreTagsRecord[key] = Object.fromEntries(tags.TagList?.map((tag) => [tag.Key, tag.Value]) ?? []);
+ awsParameterStoreTagsRecord[key] = Object.fromEntries(
+ tags.TagList?.map((tag) => [tag.Key ?? "", tag.Value ?? ""]) ?? []
+ );
} catch (e) {
// users aren't required to provide tag permissions to use sync so we handle gracefully if unauthorized
// and they aren't trying to configure tags
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 56fd3e1831..395f2611d6 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -61,6 +61,9 @@ export default defineConfig(({ mode }) => {
return { relative: true };
}
},
+ optimizeDeps: {
+ include: ["crypto"]
+ },
plugins: [
tsconfigPaths(),
nodePolyfills({