Skip to content

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

feat(secret-rotation): support supabase (#6130)

Matheus Nogueirae6408393b1e0
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts
index cfc80dca09..07cef7ba2c 100644
--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts
+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts
@@ -15,6 +15,7 @@ import { registerOpenRouterApiKeyRotationRouter } from "./open-router-api-key-ro
import { registerOracleDBCredentialsRotationRouter } from "./oracledb-credentials-rotation-router";
import { registerPostgresCredentialsRotationRouter } from "./postgres-credentials-rotation-router";
import { registerRedisCredentialsRotationRouter } from "./redis-credentials-rotation-router";
+import { registerSupabaseApiKeyRotationRouter } from "./supabase-api-key-rotation-router";
import { registerUnixLinuxLocalAccountRotationRouter } from "./unix-linux-local-account-rotation-router";
import { registerWindowsLocalAccountRotationRouter } from "./windows-local-account-rotation-router";
@@ -40,5 +41,6 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record<
[SecretRotation.DbtServiceToken]: registerDbtServiceTokenRotationRouter,
[SecretRotation.WindowsLocalAccount]: registerWindowsLocalAccountRotationRouter,
[SecretRotation.OpenRouterApiKey]: registerOpenRouterApiKeyRotationRouter,
- [SecretRotation.HpIloLocalAccount]: registerHpIloRotationRouter
+ [SecretRotation.HpIloLocalAccount]: registerHpIloRotationRouter,
+ [SecretRotation.SupabaseApiKey]: registerSupabaseApiKeyRotationRouter
};
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts
index bea5874020..e5ff3d6d48 100644
--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts
+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts
@@ -17,6 +17,7 @@ import { OracleDBCredentialsRotationListItemSchema } from "@app/ee/services/secr
import { PostgresCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/postgres-credentials";
import { RedisCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/redis-credentials";
import { SecretRotationV2Schema } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema";
+import { SupabaseApiKeyRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/supabase-api-key";
import { UnixLinuxLocalAccountRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/unix-linux-local-account-rotation";
import { WindowsLocalAccountRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/windows-local-account-rotation";
import { ApiDocsTags, SecretRotations } from "@app/lib/api-docs";
@@ -41,7 +42,8 @@ const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [
DbtServiceTokenRotationListItemSchema,
WindowsLocalAccountRotationListItemSchema,
OpenRouterApiKeyRotationListItemSchema,
- HpIloRotationListItemSchema
+ HpIloRotationListItemSchema,
+ SupabaseApiKeyRotationListItemSchema
]);
export const registerSecretRotationV2Router = async (server: FastifyZodProvider) => {
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/supabase-api-key-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/supabase-api-key-rotation-router.ts
new file mode 100644
index 0000000000..d16fabb7e0
--- /dev/null
+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/supabase-api-key-rotation-router.ts
@@ -0,0 +1,19 @@
+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
+import {
+ CreateSupabaseApiKeyRotationSchema,
+ SupabaseApiKeyRotationGeneratedCredentialsSchema,
+ SupabaseApiKeyRotationSchema,
+ UpdateSupabaseApiKeyRotationSchema
+} from "@app/ee/services/secret-rotation-v2/supabase-api-key";
+
+import { registerSecretRotationEndpoints } from "./secret-rotation-v2-endpoints";
+
+export const registerSupabaseApiKeyRotationRouter = async (server: FastifyZodProvider) =>
+ registerSecretRotationEndpoints({
+ type: SecretRotation.SupabaseApiKey,
+ server,
+ responseSchema: SupabaseApiKeyRotationSchema,
+ createSchema: CreateSupabaseApiKeyRotationSchema,
+ updateSchema: UpdateSupabaseApiKeyRotationSchema,
+ generatedCredentialsSchema: SupabaseApiKeyRotationGeneratedCredentialsSchema
+ });
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts
index 968c61a27b..4643531cc8 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts
@@ -15,7 +15,8 @@ export enum SecretRotation {
DbtServiceToken = "dbt-service-token",
WindowsLocalAccount = "windows-local-account",
OpenRouterApiKey = "open-router-api-key",
- HpIloLocalAccount = "hp-ilo-local-account"
+ HpIloLocalAccount = "hp-ilo-local-account",
+ SupabaseApiKey = "supabase-api-key"
}
export enum SecretRotationStatus {
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts
index c5950d9b29..3a47fa50b2 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts
@@ -32,6 +32,7 @@ import {
TSecretRotationV2Raw,
TUpdateSecretRotationV2DTO
} from "./secret-rotation-v2-types";
+import { SUPABASE_API_KEY_ROTATION_LIST_OPTION, TSupabaseApiKeyRotation } from "./supabase-api-key";
import {
TUnixLinuxLocalAccountRotation,
UNIX_LINUX_LOCAL_ACCOUNT_ROTATION_LIST_OPTION
@@ -58,7 +59,8 @@ const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2List
[SecretRotation.DbtServiceToken]: DBT_SERVICE_TOKEN_ROTATION_LIST_OPTION,
[SecretRotation.WindowsLocalAccount]: WINDOWS_LOCAL_ACCOUNT_ROTATION_LIST_OPTION,
[SecretRotation.OpenRouterApiKey]: OPEN_ROUTER_API_KEY_ROTATION_LIST_OPTION,
- [SecretRotation.HpIloLocalAccount]: HP_ILO_ROTATION_LIST_OPTION
+ [SecretRotation.HpIloLocalAccount]: HP_ILO_ROTATION_LIST_OPTION,
+ [SecretRotation.SupabaseApiKey]: SUPABASE_API_KEY_ROTATION_LIST_OPTION
};
export const listSecretRotationOptions = () => {
@@ -359,6 +361,17 @@ export const throwOnImmutableParameterUpdate = (
throw new BadRequestError({ message: "Cannot update rotation method or username" });
}
break;
+ case SecretRotation.SupabaseApiKey:
+ if (
+ haveUnequalProperties(
+ updatePayload.parameters as TSupabaseApiKeyRotation["parameters"],
+ secretRotation.parameters as TSupabaseApiKeyRotation["parameters"],
+ ["projectRef", "keyType"]
+ )
+ ) {
+ throw new BadRequestError({ message: "Cannot update project reference or key type" });
+ }
+ break;
default:
// do nothing
}
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts
index 15572f274b..ca22e153cc 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts
@@ -18,7 +18,8 @@ export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {
[SecretRotation.DbtServiceToken]: "DBT Service Token",
[SecretRotation.WindowsLocalAccount]: "Windows Local Account",
[SecretRotation.OpenRouterApiKey]: "OpenRouter API Key",
- [SecretRotation.HpIloLocalAccount]: "HP iLO Local Account"
+ [SecretRotation.HpIloLocalAccount]: "HP iLO Local Account",
+ [SecretRotation.SupabaseApiKey]: "Supabase API Key"
};
export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {
@@ -38,5 +39,6 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
[SecretRotation.DbtServiceToken]: AppConnection.Dbt,
[SecretRotation.WindowsLocalAccount]: AppConnection.SMB,
[SecretRotation.OpenRouterApiKey]: AppConnection.OpenRouter,
- [SecretRotation.HpIloLocalAccount]: AppConnection.SSH
+ [SecretRotation.HpIloLocalAccount]: AppConnection.SSH,
+ [SecretRotation.SupabaseApiKey]: AppConnection.Supabase
};
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts
index 26e2bc0c66..1bee6996ca 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts
@@ -97,6 +97,7 @@ import { oktaClientSecretRotationFactory } from "./okta-client-secret/okta-clien
import { openRouterApiKeyRotationFactory } from "./open-router-api-key/open-router-api-key-rotation-fns";
import { redisCredentialsRotationFactory } from "./redis-credentials/redis-credentials-rotation-fns";
import { TSecretRotationV2DALFactory } from "./secret-rotation-v2-dal";
+import { supabaseApiKeyRotationFactory } from "./supabase-api-key/supabase-api-key-rotation-fns";
import { unixLinuxLocalAccountRotationFactory } from "./unix-linux-local-account-rotation/unix-linux-local-account-rotation-fns";
import { UnixLinuxLocalAccountRotationMethod } from "./unix-linux-local-account-rotation/unix-linux-local-account-rotation-schemas";
import {
@@ -170,7 +171,8 @@ const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplem
[SecretRotation.DbtServiceToken]: dbtServiceTokenRotationFactory as TRotationFactoryImplementation,
[SecretRotation.WindowsLocalAccount]: windowsLocalAccountRotationFactory as TRotationFactoryImplementation,
[SecretRotation.OpenRouterApiKey]: openRouterApiKeyRotationFactory as TRotationFactoryImplementation,
- [SecretRotation.HpIloLocalAccount]: hpIloRotationFactory as TRotationFactoryImplementation
+ [SecretRotation.HpIloLocalAccount]: hpIloRotationFactory as TRotationFactoryImplementation,
+ [SecretRotation.SupabaseApiKey]: supabaseApiKeyRotationFactory as TRotationFactoryImplementation
};
export const secretRotationV2ServiceFactory = ({
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts
index 028aa39d76..feaa79a175 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts
@@ -109,6 +109,13 @@ import {
} from "./redis-credentials/redis-credentials-rotation-types";
import { TSecretRotationV2DALFactory } from "./secret-rotation-v2-dal";
import { SecretRotation } from "./secret-rotation-v2-enums";
+import {
+ TSupabaseApiKeyRotation,
+ TSupabaseApiKeyRotationGeneratedCredentials,
+ TSupabaseApiKeyRotationInput,
+ TSupabaseApiKeyRotationListItem,
+ TSupabaseApiKeyRotationWithConnection
+} from "./supabase-api-key";
import {
TUnixLinuxLocalAccountRotation,
TUnixLinuxLocalAccountRotationGeneratedCredentials,
@@ -141,7 +148,8 @@ export type TSecretRotationV2 =
| TDbtServiceTokenRotation
| TWindowsLocalAccountRotation
| TOpenRouterApiKeyRotation
- | THpIloRotation;
+ | THpIloRotation
+ | TSupabaseApiKeyRotation;
export type TSecretRotationV2WithConnection =
| TPostgresCredentialsRotationWithConnection
@@ -160,7 +168,8 @@ export type TSecretRotationV2WithConnection =
| TDbtServiceTokenRotationWithConnection
| TWindowsLocalAccountRotationWithConnection
| TOpenRouterApiKeyRotationWithConnection
- | THpIloRotationWithConnection;
+ | THpIloRotationWithConnection
+ | TSupabaseApiKeyRotationWithConnection;
export type TSecretRotationV2GeneratedCredentials =
| TSqlCredentialsRotationGeneratedCredentials
@@ -175,7 +184,8 @@ export type TSecretRotationV2GeneratedCredentials =
| TDbtServiceTokenRotationGeneratedCredentials
| TWindowsLocalAccountRotationGeneratedCredentials
| TOpenRouterApiKeyRotationGeneratedCredentials
- | THpIloRotationGeneratedCredentials;
+ | THpIloRotationGeneratedCredentials
+ | TSupabaseApiKeyRotationGeneratedCredentials;
export type TSecretRotationV2Input =
| TPostgresCredentialsRotationInput
@@ -194,7 +204,8 @@ export type TSecretRotationV2Input =
| TDbtServiceTokenRotationInput
| TWindowsLocalAccountRotationInput
| TOpenRouterApiKeyRotationInput
- | THpIloRotationInput;
+ | THpIloRotationInput
+ | TSupabaseApiKeyRotationInput;
export type TSecretRotationV2ListItem =
| TPostgresCredentialsRotationListItem
@@ -213,7 +224,8 @@ export type TSecretRotationV2ListItem =
| TDbtServiceTokenRotationListItem
| TWindowsLocalAccountRotationListItem
| TOpenRouterApiKeyRotationListItem
- | THpIloRotationListItem;
+ | THpIloRotationListItem
+ | TSupabaseApiKeyRotationListItem;
export type TSecretRotationV2TemporaryParameters =
| TLdapPasswordRotationInput["temporaryParameters"]
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts
index be478fde0c..8b88b76faa 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts
@@ -18,6 +18,7 @@ import { WindowsLocalAccountRotationSchema } from "@app/ee/services/secret-rotat
import { DbtServiceTokenRotationSchema } from "./dbt-service-token";
import { HpIloRotationSchema } from "./hp-ilo-rotation";
+import { SupabaseApiKeyRotationSchema } from "./supabase-api-key";
export const SecretRotationV2Schema = z.discriminatedUnion("type", [
PostgresCredentialsRotationSchema,
@@ -36,5 +37,6 @@ export const SecretRotationV2Schema = z.discriminatedUnion("type", [
DbtServiceTokenRotationSchema,
WindowsLocalAccountRotationSchema,
OpenRouterApiKeyRotationSchema,
- HpIloRotationSchema
+ HpIloRotationSchema,
+ SupabaseApiKeyRotationSchema
]);
diff --git a/backend/src/ee/services/secret-rotation-v2/supabase-api-key/index.ts b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/index.ts
new file mode 100644
index 0000000000..9e5d61a055
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/index.ts
@@ -0,0 +1,3 @@
+export * from "./supabase-api-key-rotation-constants";
+export * from "./supabase-api-key-rotation-schemas";
+export * from "./supabase-api-key-rotation-types";
diff --git a/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-constants.ts
new file mode 100644
index 0000000000..5d0604b03a
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-constants.ts
@@ -0,0 +1,14 @@
+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
+import { TSecretRotationV2ListItem } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+export const SUPABASE_API_KEY_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {
+ name: "Supabase API Key",
+ type: SecretRotation.SupabaseApiKey,
+ connection: AppConnection.Supabase,
+ template: {
+ secretsMapping: {
+ apiKey: "SUPABASE_API_KEY"
+ }
+ }
+};
diff --git a/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-fns.ts
new file mode 100644
index 0000000000..2d898d3f86
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-fns.ts
@@ -0,0 +1,156 @@
+import { AxiosError } from "axios";
+
+import {
+ TRotationFactory,
+ TRotationFactoryGetSecretsPayload,
+ TRotationFactoryIssueCredentials,
+ TRotationFactoryRevokeCredentials,
+ TRotationFactoryRotateCredentials
+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";
+import { request } from "@app/lib/config/request";
+import { BadRequestError } from "@app/lib/errors";
+import {
+ getSupabaseAuthHeaders,
+ getSupabaseInstanceUrl
+} from "@app/services/app-connection/supabase/supabase-connection-public-client";
+
+import { SupabaseApiKeyType } from "./supabase-api-key-rotation-schemas";
+import {
+ TSupabaseApiKeyCreateResponse,
+ TSupabaseApiKeyRotationGeneratedCredentials,
+ TSupabaseApiKeyRotationWithConnection
+} from "./supabase-api-key-rotation-types";
+
+const createErrorMessage = (error: unknown) => {
+ if (error instanceof AxiosError) {
+ const data = error.response?.data as { message?: string } | undefined;
+ if (data?.message) {
+ return data.message;
+ }
+ if (error.message) {
+ return error.message;
+ }
+ }
+ return (error as Error)?.message ?? "Unknown error";
+};
+
+export const supabaseApiKeyRotationFactory: TRotationFactory<
+ TSupabaseApiKeyRotationWithConnection,
+ TSupabaseApiKeyRotationGeneratedCredentials
+> = (secretRotation) => {
+ const {
+ connection,
+ parameters: { projectRef, keyType },
+ secretsMapping
+ } = secretRotation;
+
+ const connectionConfig = {
+ method: connection.method,
+ app: connection.app,
+ credentials: connection.credentials,
+ orgId: connection.orgId
+ };
+
+ const $createApiKey = async () => {
+ const baseUrl = await getSupabaseInstanceUrl(connectionConfig);
+ const headers = getSupabaseAuthHeaders(connectionConfig);
+
+ try {
+ const { data } = await request.post<TSupabaseApiKeyCreateResponse>(
+ `${baseUrl}/v1/projects/${encodeURIComponent(projectRef)}/api-keys`,
+ {
+ type: keyType === SupabaseApiKeyType.Publishable ? "publishable" : "secret",
+ name: `infisical_rotated_${keyType}_${Date.now()}`,
+ description: "Managed by Infisical secret rotation"
+ },
+ {
+ headers: {
+ ...headers,
+ "Content-Type": "application/json"
+ },
+ params: { reveal: true }
+ }
+ );
+
+ if (!data.api_key || !data.id) {
+ throw new Error("Invalid response from Supabase: missing 'api_key' or 'id'.");
+ }
+
+ return {
+ apiKey: data.api_key,
+ keyId: data.id
+ };
+ } catch (error: unknown) {
+ throw new BadRequestError({
+ message: `Failed to create Supabase API key: ${createErrorMessage(error)}`
+ });
+ }
+ };
+
+ const $deleteApiKey = async (keyId: string) => {
+ const baseUrl = await getSupabaseInstanceUrl(connectionConfig);
+ const headers = getSupabaseAuthHeaders(connectionConfig);
+
+ try {
+ await request.delete(
+ `${baseUrl}/v1/projects/${encodeURIComponent(projectRef)}/api-keys/${encodeURIComponent(keyId)}`,
+ {
+ headers,
+ params: { reason: "Rotated by Infisical" }
+ }
+ );
+ } catch (error: unknown) {
+ if (error instanceof AxiosError && error.response?.status === 404) {
+ return;
+ }
+
+ throw new BadRequestError({
+ message: `Failed to delete Supabase API key: ${createErrorMessage(error)}`
+ });
+ }
+ };
+
+ const issueCredentials: TRotationFactoryIssueCredentials<TSupabaseApiKeyRotationGeneratedCredentials> = async (
+ callback
+ ) => {
+ const credentials = await $createApiKey();
+ return callback(credentials);
+ };
+
+ const revokeCredentials: TRotationFactoryRevokeCredentials<TSupabaseApiKeyRotationGeneratedCredentials> = async (
+ credentials,
+ callback
+ ) => {
+ if (!credentials?.length) return callback();
+
+ await Promise.all(credentials.map(({ keyId }) => $deleteApiKey(keyId)));
+
+ return callback();
+ };
+
+ const rotateCredentials: TRotationFactoryRotateCredentials<TSupabaseApiKeyRotationGeneratedCredentials> = async (
+ oldCredentials,
+ callback
+ ) => {
+ const newCredentials = await $createApiKey();
+
+ const result = await callback(newCredentials);
+
+ if (oldCredentials?.keyId) {
+ await $deleteApiKey(oldCredentials.keyId);
+ }
+
+ return result;
+ };
+
+ const getSecretsPayload: TRotationFactoryGetSecretsPayload<TSupabaseApiKeyRotationGeneratedCredentials> = ({
+ apiKey
+ }) => [{ key: secretsMapping.apiKey, value: apiKey }];
+
+ return {
+ issueCredentials,
+ revokeCredentials,
+ rotateCredentials,
+ getSecretsPayload
+ };
+};
diff --git a/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-schemas.ts
new file mode 100644
index 0000000000..b3b262eeab
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-schemas.ts
@@ -0,0 +1,67 @@
+import { z } from "zod";
+
+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
+import {
+ BaseCreateSecretRotationSchema,
+ BaseSecretRotationSchema,
+ BaseUpdateSecretRotationSchema
+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-schemas";
+import { SecretRotations } from "@app/lib/api-docs";
+import { SecretNameSchema } from "@app/server/lib/schemas";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+export const SupabaseApiKeyRotationGeneratedCredentialsSchema = z
+ .object({
+ apiKey: z.string(),
+ keyId: z.string()
+ })
+ .array()
+ .min(1)
+ .max(2);
+
+export enum SupabaseApiKeyType {
+ Publishable = "publishable",
+ Secret = "secret"
+}
+
+const SupabaseApiKeyRotationParametersSchema = z.object({
+ projectRef: z
+ .string()
+ .trim()
+ .min(1, "Project reference required")
+ .describe(SecretRotations.PARAMETERS.SUPABASE_API_KEY.projectRef),
+ keyType: z.nativeEnum(SupabaseApiKeyType).describe(SecretRotations.PARAMETERS.SUPABASE_API_KEY.keyType)
+});
+
+const SupabaseApiKeyRotationSecretsMappingSchema = z.object({
+ apiKey: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.SUPABASE_API_KEY.apiKey)
+});
+
+export const SupabaseApiKeyRotationTemplateSchema = z.object({
+ secretsMapping: z.object({
+ apiKey: z.string()
+ })
+});
+
+export const SupabaseApiKeyRotationSchema = BaseSecretRotationSchema(SecretRotation.SupabaseApiKey).extend({
+ type: z.literal(SecretRotation.SupabaseApiKey),
+ parameters: SupabaseApiKeyRotationParametersSchema,
+ secretsMapping: SupabaseApiKeyRotationSecretsMappingSchema
+});
+
+export const CreateSupabaseApiKeyRotationSchema = BaseCreateSecretRotationSchema(SecretRotation.SupabaseApiKey).extend({
+ parameters: SupabaseApiKeyRotationParametersSchema,
+ secretsMapping: SupabaseApiKeyRotationSecretsMappingSchema
+});
+
+export const UpdateSupabaseApiKeyRotationSchema = BaseUpdateSecretRotationSchema(SecretRotation.SupabaseApiKey).extend({
+ parameters: SupabaseApiKeyRotationParametersSchema.optional(),
+ secretsMapping: SupabaseApiKeyRotationSecretsMappingSchema.optional()
+});
+
+export const SupabaseApiKeyRotationListItemSchema = z.object({
+ name: z.literal("Supabase API Key"),
+ connection: z.literal(AppConnection.Supabase),
+ type: z.literal(SecretRotation.SupabaseApiKey),
+ template: SupabaseApiKeyRotationTemplateSchema
+});
diff --git a/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-types.ts
new file mode 100644
index 0000000000..374b2489eb
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/supabase-api-key/supabase-api-key-rotation-types.ts
@@ -0,0 +1,37 @@
+import { z } from "zod";
+
+import { TSupabaseConnection } from "@app/services/app-connection/supabase";
+
+import {
+ CreateSupabaseApiKeyRotationSchema,
+ SupabaseApiKeyRotationGeneratedCredentialsSchema,
+ SupabaseApiKeyRotationListItemSchema,
+ SupabaseApiKeyRotationSchema
+} from "./supabase-api-key-rotation-schemas";
+
+export type TSupabaseApiKeyRotation = z.infer<typeof SupabaseApiKeyRotationSchema>;
+
+export type TSupabaseApiKeyRotationInput = z.infer<typeof CreateSupabaseApiKeyRotationSchema>;
+
+export type TSupabaseApiKeyRotationListItem = z.infer<typeof SupabaseApiKeyRotationListItemSchema>;
+
+export type TSupabaseApiKeyRotationWithConnection = TSupabaseApiKeyRotation & {
+ connection: TSupabaseConnection;
+};
+
+export type TSupabaseApiKeyRotationGeneratedCredentials = z.infer<
+ typeof SupabaseApiKeyRotationGeneratedCredentialsSchema
+>;
+
+export type TSupabaseApiKeyCreateResponse = {
+ api_key: string | null;
+ id: string | null;
+ type: "legacy" | "publishable" | "secret" | null;
+ prefix: string | null;
+ name: string;
+ description: string | null;
+ hash: string | null;
+ secret_jwt_template: Record<string, unknown> | null;
+ inserted_at: string | null;
+ updated_at: string | null;
+};
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 21589317c9..956202ade3 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -3261,6 +3261,10 @@ export const SecretRotations = {
limitReset: "The type of limit reset for the API key (daily, weekly, monthly, or null for no reset).",
includeByokInLimit:
"Whether to include BYOK (Bring Your Own Key) usage in the spending limit. When enabled, usage from your own provider keys counts toward this key's limit. See OpenRouter BYOK docs for details."
+ },
+ SUPABASE_API_KEY: {
+ projectRef: "The reference ID of the Supabase project to rotate the API key for.",
+ keyType: "The type of the API key to rotate (e.g. publishable, secret)."
}
},
SECRETS_MAPPING: {
@@ -3321,6 +3325,9 @@ export const SecretRotations = {
},
OPEN_ROUTER_API_KEY: {
apiKey: "The name of the secret that the rotated OpenRouter API key will be mapped to."
+ },
+ SUPABASE_API_KEY: {
+ apiKey: "The name of the secret that the rotated Supabase API key will be mapped to."
}
}
};
diff --git a/docs/api-reference/endpoints/secret-rotations/supabase-api-key/create.mdx b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/create.mdx
new file mode 100644
index 0000000000..31b43527f4
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/create.mdx
@@ -0,0 +1,77 @@
+---
+title: "Create"
+openapi: "POST /api/v2/secret-rotations/supabase-api-key"
+---
+
+<Note>
+ Check out the configuration docs for [Supabase API Key Rotations](/documentation/platform/secret-rotation/supabase-api-key) to learn how to obtain the required parameters.
+</Note>
+
+Creates a Supabase API Key secret rotation. Infisical will create and rotate API keys via your [Supabase connection](/integrations/app-connections/supabase) and write them to the specified secret path.
+
+## Request body
+
+| Field | Type | Required | Description |
+|-------|------|----------|-------------|
+| `name` | string | Yes | A unique name for the rotation (max 100 characters). |
+| `projectId` | string (UUID) | Yes | The project ID. |
+| `connectionId` | string (UUID) | Yes | ID of the Supabase app connection. |
+| `environment` | string | Yes | Environment slug (e.g. `dev`, `prod`). |
+| `secretPath` | string | Yes | Path where the generated API key secret will be stored. |
+| `isAutoRotationEnabled` | boolean | No | Whether to rotate automatically on the schedule. Defaults to `true`. |
+| `rotationInterval` | number | Yes | Days between rotations (minimum `1`). |
+| `rotateAtUtc` | object | No | Time of day (UTC) to run rotation: `{ "hours", "minutes" }`. Defaults to `{ "hours": 0, "minutes": 0 }`. |
+| `parameters.projectRef` | string | Yes | The reference ID of the Supabase project to rotate the API key for. |
+| `parameters.keyType` | string | Yes | The type of the API key to rotate: `"publishable"` or `"secret"`. |
+| `secretsMapping.apiKey` | string | Yes | Secret key name to store the generated API key (e.g. `SUPABASE_SECRET_API_KEY`). |
+| `description` | string | No | Optional description. |
+
+## Sample request
+
+```bash
+curl --request POST \
+ --url https://us.infisical.com/api/v2/secret-rotations/supabase-api-key \
+ --header 'Content-Type: application/json' \
+ --header 'Authorization: Bearer <ACCESS_TOKEN>' \
+ --data '{
+ "name": "my-supabase-rotation",
+ "projectId": "<project-id>",
+ "description": "Supabase API key rotation",
+ "connectionId": "<supabase-connection-id>",
+ "environment": "dev",
+ "secretPath": "/",
+ "isAutoRotationEnabled": true,
+ "rotationInterval": 30,
+ "rotateAtUtc": { "hours": 0, "minutes": 0 },
+ "parameters": {
+ "projectRef": "<supabase-project-ref>",
+ "keyType": "secret"
+ },
+ "secretsMapping": {
+ "apiKey": "SUPABASE_SECRET_API_KEY"
+ }
+ }'
+```
+
+## Sample response
+
+```json
+{
+ "secretRotation": {
+ "id": "<rotation-id>",
+ "name": "my-supabase-rotation",
+ "description": "Supabase API key rotation",
+ "secretsMapping": { "apiKey": "SUPABASE_SECRET_API_KEY" },
+ "isAutoRotationEnabled": true,
+ "activeIndex": 0,
+ "connectionId": "<supabase-connection-id>",
+ "rotationInterval": 30,
+ "rotateAtUtc": { "hours": 0, "minutes": 0 },
+ "type": "supabase-api-key",
+ "parameters": {
+ "projectRef": "<supabase-project-ref>",
+ "keyType": "secret"
+ }
+ }
+}
+```
diff --git a/docs/api-reference/endpoints/secret-rotations/supabase-api-key/delete.mdx b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/delete.mdx
new file mode 100644
index 0000000000..9ceb12ea6a
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/delete.mdx
@@ -0,0 +1,4 @@
+---
+title: "Delete"
+openapi: "DELETE /api/v2/secret-rotations/supabase-api-key/{rotationId}"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/supabase-api-key/get-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/get-by-id.mdx
new file mode 100644
index 0000000000..87b8ae2dca
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/get-by-id.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by ID"
+openapi: "GET /api/v2/secret-rotations/supabase-api-key/{rotationId}"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/supabase-api-key/get-by-name.mdx b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/get-by-name.mdx
new file mode 100644
index 0000000000..99655c6502
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/get-by-name.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by Name"
+openapi: "GET /api/v2/secret-rotations/supabase-api-key/rotation-name/{rotationName}"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/supabase-api-key/get-generated-credentials-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/get-generated-credentials-by-id.mdx
new file mode 100644
index 0000000000..375c2bd856
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/get-generated-credentials-by-id.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get Credentials by ID"
+openapi: "GET /api/v2/secret-rotations/supabase-api-key/{rotationId}/generated-credentials"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/supabase-api-key/list.mdx b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/list.mdx
new file mode 100644
index 0000000000..9970adb0ac
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/list.mdx
@@ -0,0 +1,4 @@
+---
+title: "List"
+openapi: "GET /api/v2/secret-rotations/supabase-api-key"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/supabase-api-key/rotate-secrets.mdx b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/rotate-secrets.mdx
new file mode 100644
index 0000000000..083f078879
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/rotate-secrets.mdx
@@ -0,0 +1,4 @@
+---
+title: "Rotate Secrets"
+openapi: "POST /api/v2/secret-rotations/supabase-api-key/{rotationId}/rotate-secrets"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/supabase-api-key/update.mdx b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/update.mdx
new file mode 100644
index 0000000000..49d888b85f
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/supabase-api-key/update.mdx
@@ -0,0 +1,8 @@
+---
+title: "Update"
+openapi: "PATCH /api/v2/secret-rotations/supabase-api-key/{rotationId}"
+---
+
+<Note>
+ Check out the configuration docs for [Supabase API Key Rotations](/documentation/platform/secret-rotation/supabase-api-key) to learn how to obtain the required parameters.
+</Note>
diff --git a/docs/docs.json b/docs/docs.json
index adb376fad8..c151e67e77 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -483,6 +483,7 @@
"documentation/platform/secret-rotation/oracledb-credentials",
"documentation/platform/secret-rotation/postgres-credentials",
"documentation/platform/secret-rotation/redis-credentials",
+ "documentation/platform/secret-rotation/supabase-api-key",
"documentation/platform/secret-rotation/unix-linux-local-account",
"documentation/platform/secret-rotation/windows-local-account"
]
@@ -2382,6 +2383,19 @@
"api-reference/endpoints/secret-rotations/redis-credentials/update"
]
},
+ {
+ "group": "Supabase API Key",
+ "pages": [
+ "api-reference/endpoints/secret-rotations/supabase-api-key/create",
+ "api-reference/endpoints/secret-rotations/supabase-api-key/delete",
+ "api-reference/endpoints/secret-rotations/supabase-api-key/get-by-id",
+ "api-reference/endpoints/secret-rotations/supabase-api-key/get-by-name",
+ "api-reference/endpoints/secret-rotations/supabase-api-key/get-generated-credentials-by-id",
+ "api-reference/endpoints/secret-rotations/supabase-api-key/list",
+ "api-reference/endpoints/secret-rotations/supabase-api-key/rotate-secrets",
+ "api-reference/endpoints/secret-rotations/supabase-api-key/update"
+ ]
+ },
{
"group": "HP iLO Local Account",
"pages": [
diff --git a/docs/documentation/platform/secret-rotation/supabase-api-key.mdx b/docs/documentation/platform/secret-rotation/supabase-api-key.mdx
new file mode 100644
index 0000000000..c4b95b293e
--- /dev/null
+++ b/docs/documentation/platform/secret-rotation/supabase-api-key.mdx
@@ -0,0 +1,124 @@
+---
+title: "Supabase API Key"
+description: "Learn how to automatically rotate Supabase API keys."
+---
+
+<Note>
+ **Rotation Type: Dual-Phase**
+
+ This rotation maintains two active credential sets with overlapping validity, ensuring zero-downtime during rotation cycles.
+</Note>
+
+## Prerequisites
+
+- Create a [Supabase Connection](/integrations/app-connections/supabase). That connection is used to create and delete API keys on your behalf during rotation.
+
+## Create a Supabase API Key Rotation in Infisical
+
+<Tabs>
+ <Tab title="Infisical UI">
+ 1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.
+
+ ![Secret Manager Dashboard](/images/secret-rotations-v2/generic/add-secret-rotation.png)
+
+ 2. Select the **Supabase API Key** option.
+
+ ![Select Supabase API Key](/images/secret-rotations-v2/supabase-api-key/select-supabase-api-key.png)
+
+ 3. Configure the rotation behavior, then click **Next**.
+
+ - **Supabase Connection** – The connection that will create and delete API keys during rotation.
+ - **Rotation Interval** – The interval, in days, after which a rotation is triggered.
+ - **Rotate At** – The local time of day when rotation runs once the interval has elapsed.
+ - **Auto-Rotation Enabled** – Whether to rotate automatically on the interval. Turn off to rotate only manually or pause rotation.
+
+ ![Rotation Configuration](/images/secret-rotations-v2/supabase-api-key/configuration.png)
+
+ 4. Set the Supabase API key parameters, then click **Next**.
+
+ - **Project** – The Supabase project to rotate the API key for.
+ - **Key Type** – The type of the API key to rotate:
+ - `publishable` – The public `anon` key, safe to expose in client-side code. It is used with Row Level Security (RLS) policies to control per-user access.
+ - `secret` – The `service_role` key, which bypasses RLS entirely and has full access to your project's data. Must be kept server-side only.
+
+ ![Rotation Parameters](/images/secret-rotations-v2/supabase-api-key/parameters.png)
+
+ 5. Specify the secret name that the rotated API key will be mapped to. Then click **Next**.
+
+ - **API Key** – The name of the secret in Infisical where the rotated API key value will be stored.
+
+ ![Rotation Secrets Mapping](/images/secret-rotations-v2/supabase-api-key/secrets-mapping.png)
+
+ 6. Give your rotation a name and description (optional). Then click **Next**.
+
+ - **Name** – A slug-friendly name for this rotation configuration.
+ - **Description** (optional) – Notes about this rotation.
+
+ ![Rotation Details](/images/secret-rotations-v2/supabase-api-key/details.png)
+
+ 7. Review your configuration, then click **Create Secret Rotation**.
+
+ ![Rotation Review](/images/secret-rotations-v2/supabase-api-key/review.png)
+
+ 8. Your **Supabase API Key** rotation is created. The current API key is available as a secret at the mapped path. Rotations will create a new key, switch the active secret to it, then revoke the previous key for zero-downtime rotation.
+
+ ![Rotation Created](/images/secret-rotations-v2/supabase-api-key/created.png)
+ </Tab>
+ <Tab title="API">
+ To create a Supabase API Key rotation, call the [Create Supabase API Key Rotation](/api-reference/endpoints/secret-rotations/supabase-api-key/create) API endpoint.
+
+ ### Sample request
+
+ ```bash Request
+ curl --request POST \
+ --url https://us.infisical.com/api/v2/secret-rotations/supabase-api-key \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "name": "my-supabase-rotation",
+ "projectId": "<project-id>",
+ "description": "Supabase API key rotation",
+ "connectionId": "<supabase-connection-id>",
+ "environment": "dev",
+ "secretPath": "/",
+ "isAutoRotationEnabled": true,
+ "rotationInterval": 30,
+ "rotateAtUtc": {
+ "hours": 0,
+ "minutes": 0
+ },
+ "parameters": {
+ "projectRef": "<supabase-project-ref>",
+ "keyType": "secret"
+ },
+ "secretsMapping": {
+ "apiKey": "SUPABASE_API_KEY"
+ }
+ }'
+ ```
+
+ ### Sample response
+
+ ```bash Response
+ {
+ "secretRotation": {
+ "id": "<rotation-id>",
+ "name": "my-supabase-rotation",
+ "description": "Supabase API key rotation",
+ "secretsMapping": {
+ "apiKey": "SUPABASE_API_KEY"
+ },
+ "isAutoRotationEnabled": true,
+ "activeIndex": 0,
+ "connectionId": "<supabase-connection-id>",
+ "rotationInterval": 30,
+ "rotateAtUtc": { "hours": 0, "minutes": 0 },
+ "type": "supabase-api-key",
+ "parameters": {
+ "projectRef": "<supabase-project-ref>",
+ "keyType": "secret"
+ }
+ }
+ }
+ ```
+ </Tab>
+</Tabs>
diff --git a/docs/images/secret-rotations-v2/generic/add-secret-rotation.png b/docs/images/secret-rotations-v2/generic/add-secret-rotation.png
index 4b1b626ae2..d8c1867d5c 100644
Binary files a/docs/images/secret-rotations-v2/generic/add-secret-rotation.png and b/docs/images/secret-rotations-v2/generic/add-secret-rotation.png differ
diff --git a/docs/images/secret-rotations-v2/supabase-api-key/configuration.png b/docs/images/secret-rotations-v2/supabase-api-key/configuration.png
new file mode 100644
index 0000000000..2ef726bd2d
Binary files /dev/null and b/docs/images/secret-rotations-v2/supabase-api-key/configuration.png differ
diff --git a/docs/images/secret-rotations-v2/supabase-api-key/created.png b/docs/images/secret-rotations-v2/supabase-api-key/created.png
new file mode 100644
index 0000000000..623bbf4edc
Binary files /dev/null and b/docs/images/secret-rotations-v2/supabase-api-key/created.png differ
diff --git a/docs/images/secret-rotations-v2/supabase-api-key/details.png b/docs/images/secret-rotations-v2/supabase-api-key/details.png
new file mode 100644
index 0000000000..2935b46a8a
Binary files /dev/null and b/docs/images/secret-rotations-v2/supabase-api-key/details.png differ
diff --git a/docs/images/secret-rotations-v2/supabase-api-key/parameters.png b/docs/images/secret-rotations-v2/supabase-api-key/parameters.png
new file mode 100644
index 0000000000..798c17dfec
Binary files /dev/null and b/docs/images/secret-rotations-v2/supabase-api-key/parameters.png differ
diff --git a/docs/images/secret-rotations-v2/supabase-api-key/review.png b/docs/images/secret-rotations-v2/supabase-api-key/review.png
new file mode 100644
index 0000000000..ae76a817f4
Binary files /dev/null and b/docs/images/secret-rotations-v2/supabase-api-key/review.png differ
diff --git a/docs/images/secret-rotations-v2/supabase-api-key/secrets-mapping.png b/docs/images/secret-rotations-v2/supabase-api-key/secrets-mapping.png
new file mode 100644
index 0000000000..8adc0ca9df
Binary files /dev/null and b/docs/images/secret-rotations-v2/supabase-api-key/secrets-mapping.png differ
diff --git a/docs/images/secret-rotations-v2/supabase-api-key/select-supabase-api-key.png b/docs/images/secret-rotations-v2/supabase-api-key/select-supabase-api-key.png
new file mode 100644
index 0000000000..baba82fcbf
Binary files /dev/null and b/docs/images/secret-rotations-v2/supabase-api-key/select-supabase-api-key.png differ
diff --git a/docs/snippets/RotationsBrowser.jsx b/docs/snippets/RotationsBrowser.jsx
index f6d006dd33..897d8ff255 100644
--- a/docs/snippets/RotationsBrowser.jsx
+++ b/docs/snippets/RotationsBrowser.jsx
@@ -151,6 +151,15 @@ export const RotationsBrowser = () => {
category: "AI & LLM",
rotationType: "Dual-Phase",
},
+ {
+ name: "Supabase API Key",
+ slug: "supabase-api-key",
+ path: "/documentation/platform/secret-rotation/supabase-api-key",
+ description:
+ "Learn how to automatically rotate Supabase API keys.",
+ category: "Cloud Providers",
+ rotationType: "Dual-Phase",
+ },
].sort(function (a, b) {
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
});
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
index 7fa9c7d5a0..7a523c686c 100644
--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
@@ -28,6 +28,7 @@ import { ViewHpIloRotationGeneratedCredentials } from "./ViewHpIloRotationGenera
import { ViewOktaClientSecretRotationGeneratedCredentials } from "./ViewOktaClientSecretRotationGeneratedCredentials";
import { ViewOpenRouterApiKeyRotationGeneratedCredentials } from "./ViewOpenRouterApiKeyRotationGeneratedCredentials";
import { ViewRedisCredentialsRotationGeneratedCredentials } from "./ViewRedisCredentialsRotationGeneratedCredentials";
+import { ViewSupabaseApiKeyRotationGeneratedCredentials } from "./ViewSupabaseApiKeyRotationGeneratedCredentials";
import { ViewUnixLinuxLocalAccountRotationGeneratedCredentials } from "./ViewUnixLinuxLocalAccountRotationGeneratedCredentials";
import { ViewWindowsLocalAccountRotationGeneratedCredentials } from "./ViewWindowsLocalAccountRotationGeneratedCredentials";
@@ -164,6 +165,13 @@ const Content = ({ secretRotation }: ContentProps) => {
/>
);
break;
+ case SecretRotation.SupabaseApiKey:
+ Component = (
+ <ViewSupabaseApiKeyRotationGeneratedCredentials
+ generatedCredentialsResponse={generatedCredentialsResponse}
+ />
+ );
+ break;
default:
throw new Error("Unhandled View Generated Credential Rotation Type");
}
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSupabaseApiKeyRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSupabaseApiKeyRotationGeneratedCredentials.tsx
new file mode 100644
index 0000000000..44159c438e
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSupabaseApiKeyRotationGeneratedCredentials.tsx
@@ -0,0 +1,32 @@
+import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";
+import { TSupabaseApiKeyRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/supabase-api-key-rotation";
+
+import { ViewRotationGeneratedCredentialsDisplay } from "./shared";
+
+type Props = {
+ generatedCredentialsResponse: TSupabaseApiKeyRotationGeneratedCredentialsResponse;
+};
+
+export const ViewSupabaseApiKeyRotationGeneratedCredentials = ({
+ generatedCredentialsResponse: { generatedCredentials, activeIndex }
+}: Props) => {
+ const inactiveIndex = activeIndex === 0 ? 1 : 0;
+
+ const activeCredentials = generatedCredentials[activeIndex];
+ const inactiveCredentials = generatedCredentials[inactiveIndex];
+
+ return (
+ <ViewRotationGeneratedCredentialsDisplay
+ activeCredentials={
+ <CredentialDisplay isSensitive label="API Key">
+ {activeCredentials?.apiKey}
+ </CredentialDisplay>
+ }
+ inactiveCredentials={
+ <CredentialDisplay isSensitive label="API Key">
+ {inactiveCredentials?.apiKey}
+ </CredentialDisplay>
+ }
+ />
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
index 66d1035da1..eab5d623ce 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
@@ -15,6 +15,7 @@ import { OktaClientSecretRotationParametersFields } from "./OktaClientSecretRota
import { OpenRouterApiKeyRotationParametersFields } from "./OpenRouterApiKeyRotationParametersFields";
import { RedisCredentialsRotationParametersFields } from "./RedisCredentialsRotationParametersFields";
import { SqlCredentialsRotationParametersFields } from "./shared";
+import { SupabaseApiKeyRotationParametersFields } from "./SupabaseApiKeyRotationParametersFields";
import { UnixLinuxLocalAccountRotationParametersFields } from "./UnixLinuxLocalAccountRotationParametersFields";
import { WindowsLocalAccountRotationParametersFields } from "./WindowsLocalAccountRotationParametersFields";
@@ -36,7 +37,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.DbtServiceToken]: DbtServiceTokenRotationParametersFields,
[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationParametersFields,
[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationParametersFields,
- [SecretRotation.HpIloLocalAccount]: HpIloRotationParametersFields
+ [SecretRotation.HpIloLocalAccount]: HpIloRotationParametersFields,
+ [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationParametersFields
};
export const SecretRotationV2ParametersFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SupabaseApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SupabaseApiKeyRotationParametersFields.tsx
new file mode 100644
index 0000000000..67fbcdd275
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SupabaseApiKeyRotationParametersFields.tsx
@@ -0,0 +1,97 @@
+import { Controller, useFormContext, useWatch } from "react-hook-form";
+import { SingleValue } from "react-select";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FilterableSelect, FormControl } from "@app/components/v2";
+import {
+ TSupabaseProject,
+ useSupabaseConnectionListProjects
+} from "@app/hooks/api/appConnections/supabase";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import { SupabaseApiKeyType } from "@app/hooks/api/secretRotationsV2/types/supabase-api-key-rotation";
+
+const KEY_TYPE_OPTIONS = [
+ { label: "Publishable", value: SupabaseApiKeyType.Publishable },
+ { label: "Secret", value: SupabaseApiKeyType.Secret }
+];
+
+const formatProjectOptionLabel = (option: TSupabaseProject) => (
+ <span>
+ {option.name} <span className="text-mineshaft-400">(id: {option.id})</span>
+ </span>
+);
+
+export const SupabaseApiKeyRotationParametersFields = () => {
+ const { control } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.SupabaseApiKey;
+ }
+ >();
+
+ const connectionId = useWatch({ name: "connection.id", control });
+
+ const { data: projects = [], isPending: isProjectsLoading } = useSupabaseConnectionListProjects(
+ connectionId,
+ {
+ enabled: Boolean(connectionId)
+ }
+ );
+
+ return (
+ <>
+ <Controller
+ name="parameters.projectRef"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Project"
+ tooltipText="The Supabase project to rotate the API key for"
+ >
+ <FilterableSelect
+ isLoading={isProjectsLoading && Boolean(connectionId)}
+ isDisabled={!connectionId}
+ value={projects.find((p) => p.id === value) ?? null}
+ onChange={(option) => {
+ const v = option as SingleValue<TSupabaseProject>;
+ onChange(v?.id ?? null);
+ }}
+ options={projects}
+ placeholder="Select a project..."
+ getOptionLabel={(option) => `${option.name} (id: ${option.id})`}
+ getOptionValue={(option) => option.id}
+ formatOptionLabel={formatProjectOptionLabel}
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="parameters.keyType"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Key Type"
+ tooltipText="Publishable keys are safe to use in browsers and client-side code. Secret keys grant privileged access to the project API and should never be exposed publicly."
+ >
+ <FilterableSelect
+ value={KEY_TYPE_OPTIONS.find((o) => o.value === value) ?? null}
+ onChange={(option) =>
+ onChange(
+ (option as SingleValue<{ label: string; value: SupabaseApiKeyType }>)?.value ??
+ null
+ )
+ }
+ options={KEY_TYPE_OPTIONS}
+ getOptionLabel={(option) => option.label}
+ getOptionValue={(option) => option.value}
+ placeholder="Select a key type..."
+ />
+ </FormControl>
+ )}
+ />
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
index 907801493d..cef3ad5faa 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
@@ -17,6 +17,7 @@ import { OktaClientSecretRotationReviewFields } from "./OktaClientSecretRotation
import { OpenRouterApiKeyRotationReviewFields } from "./OpenRouterApiKeyRotationReviewFields";
import { RedisCredentialsRotationReviewFields } from "./RedisCredentialsRotationReviewFields";
import { SqlCredentialsRotationReviewFields } from "./shared";
+import { SupabaseApiKeyRotationReviewFields } from "./SupabaseApiKeyRotationReviewFields";
import { UnixLinuxLocalAccountRotationReviewFields } from "./UnixLinuxLocalAccountRotationReviewFields";
import { WindowsLocalAccountRotationReviewFields } from "./WindowsLocalAccountRotationReviewFields";
@@ -38,7 +39,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.DbtServiceToken]: DbtServiceTokenRotationReviewFields,
[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationReviewFields,
[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationReviewFields,
- [SecretRotation.HpIloLocalAccount]: HpIloRotationReviewFields
+ [SecretRotation.HpIloLocalAccount]: HpIloRotationReviewFields,
+ [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationReviewFields
};
export const SecretRotationV2ReviewFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SupabaseApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SupabaseApiKeyRotationReviewFields.tsx
new file mode 100644
index 0000000000..f89bcaaf2c
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SupabaseApiKeyRotationReviewFields.tsx
@@ -0,0 +1,37 @@
+import { useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { GenericFieldLabel } from "@app/components/v2";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import { SupabaseApiKeyType } from "@app/hooks/api/secretRotationsV2/types/supabase-api-key-rotation";
+
+import { SecretRotationReviewSection } from "./shared";
+
+const KEY_TYPE_LABELS: Record<SupabaseApiKeyType, string> = {
+ [SupabaseApiKeyType.Publishable]: "Publishable",
+ [SupabaseApiKeyType.Secret]: "Secret"
+};
+
+export const SupabaseApiKeyRotationReviewFields = () => {
+ const { watch } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.SupabaseApiKey;
+ }
+ >();
+
+ const [parameters, { apiKey }] = watch(["parameters", "secretsMapping"]);
+
+ return (
+ <>
+ <SecretRotationReviewSection label="Parameters">
+ <GenericFieldLabel label="Project Reference">{parameters.projectRef}</GenericFieldLabel>
+ <GenericFieldLabel label="Key Type">
+ {KEY_TYPE_LABELS[parameters.keyType] || parameters.keyType}
+ </GenericFieldLabel>
+ </SecretRotationReviewSection>
+ <SecretRotationReviewSection label="Secrets Mapping">
+ <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
+ </SecretRotationReviewSection>
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
index f4d02c179a..e9878c6577 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
@@ -14,6 +14,7 @@ import { OktaClientSecretRotationSecretsMappingFields } from "./OktaClientSecret
import { OpenRouterApiKeyRotationSecretsMappingFields } from "./OpenRouterApiKeyRotationSecretsMappingFields";
import { RedisCredentialsRotationSecretsMappingFields } from "./RedisCredentialsRotationSecretsMappingFields";
import { SqlCredentialsRotationSecretsMappingFields } from "./shared";
+import { SupabaseApiKeyRotationSecretsMappingFields } from "./SupabaseApiKeyRotationSecretsMappingFields";
import { UnixLinuxLocalAccountRotationSecretsMappingFields } from "./UnixLinuxLocalAccountRotationSecretsMappingFields";
import { WindowsLocalAccountRotationSecretsMappingFields } from "./WindowsLocalAccountRotationSecretsMappingFields";
@@ -35,7 +36,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.DbtServiceToken]: DbtServiceTokenRotationSecretsMappingFields,
[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationSecretsMappingFields,
[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationSecretsMappingFields,
- [SecretRotation.HpIloLocalAccount]: HpIloRotationSecretsMappingFields
+ [SecretRotation.HpIloLocalAccount]: HpIloRotationSecretsMappingFields,
+ [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationSecretsMappingFields
};
export const SecretRotationV2SecretsMappingFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SupabaseApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SupabaseApiKeyRotationSecretsMappingFields.tsx
new file mode 100644
index 0000000000..3da2c8e224
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SupabaseApiKeyRotationSecretsMappingFields.tsx
@@ -0,0 +1,55 @@
+import { useEffect, useRef } from "react";
+import { Controller, useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FormControl, Input } from "@app/components/v2";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import { SupabaseApiKeyType } from "@app/hooks/api/secretRotationsV2/types/supabase-api-key-rotation";
+
+import { SecretsMappingTable } from "./shared";
+
+const DEFAULT_SECRET_NAME: Record<SupabaseApiKeyType, string> = {
+ [SupabaseApiKeyType.Publishable]: "SUPABASE_PUBLISHABLE_API_KEY",
+ [SupabaseApiKeyType.Secret]: "SUPABASE_SECRET_API_KEY"
+};
+
+export const SupabaseApiKeyRotationSecretsMappingFields = () => {
+ const { control, watch, setValue } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.SupabaseApiKey;
+ }
+ >();
+
+ const keyType = watch("parameters.keyType");
+ const prevKeyTypeRef = useRef<SupabaseApiKeyType | undefined>(undefined);
+
+ useEffect(() => {
+ if (keyType && prevKeyTypeRef.current !== keyType) {
+ setValue("secretsMapping.apiKey", DEFAULT_SECRET_NAME[keyType]);
+ }
+ prevKeyTypeRef.current = keyType;
+ }, [keyType, setValue]);
+
+ const items = [
+ {
+ name: "API Key",
+ input: (
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Input
+ value={value}
+ onChange={onChange}
+ placeholder={keyType ? DEFAULT_SECRET_NAME[keyType] : "SUPABASE_API_KEY"}
+ />
+ </FormControl>
+ )}
+ control={control}
+ name="secretsMapping.apiKey"
+ />
+ )
+ }
+ ];
+
+ return <SecretsMappingTable items={items} />;
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
index 65689435ca..863061b4f7 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
@@ -21,6 +21,7 @@ import { OktaClientSecretRotationSchema } from "./okta-client-secret-rotation-sc
import { OpenRouterApiKeyRotationSchema } from "./open-router-api-key-rotation-schema";
import { OracleDBCredentialsRotationSchema } from "./oracledb-credentials-rotation-schema";
import { RedisCredentialsRotationSchema } from "./redis-credentials-rotation-schema";
+import { SupabaseApiKeyRotationSchema } from "./supabase-api-key-rotation-schema";
import { UnixLinuxLocalAccountRotationSchema } from "./unix-linux-local-account-rotation-schema";
import { WindowsLocalAccountRotationSchema } from "./windows-local-account-rotation-schema";
@@ -44,7 +45,8 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>
DbtServiceTokenRotationSchema,
WindowsLocalAccountRotationSchema,
OpenRouterApiKeyRotationSchema,
- HpIloRotationSchema
+ HpIloRotationSchema,
+ SupabaseApiKeyRotationSchema
]),
z.object({ id: z.string().optional() })
)
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/supabase-api-key-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/supabase-api-key-rotation-schema.ts
new file mode 100644
index 0000000000..0ebcf74647
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/supabase-api-key-rotation-schema.ts
@@ -0,0 +1,18 @@
+import { z } from "zod";
+
+import { BaseSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/base-secret-rotation-v2-schema";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import { SupabaseApiKeyType } from "@app/hooks/api/secretRotationsV2/types/supabase-api-key-rotation";
+
+export const SupabaseApiKeyRotationSchema = z
+ .object({
+ type: z.literal(SecretRotation.SupabaseApiKey),
+ parameters: z.object({
+ projectRef: z.string().trim().min(1, "Project reference required"),
+ keyType: z.nativeEnum(SupabaseApiKeyType)
+ }),
+ secretsMapping: z.object({
+ apiKey: z.string().trim().min(1, "API Key secret name required")
+ })
+ })
+ .merge(BaseSecretRotationSchema);
diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.ts
index cdda10b1fd..55afff89bb 100644
--- a/frontend/src/helpers/secretRotationsV2.ts
+++ b/frontend/src/helpers/secretRotationsV2.ts
@@ -89,6 +89,11 @@ export const SECRET_ROTATION_MAP: Record<
name: "HP iLO Local Account",
image: "SSH.png",
size: 50
+ },
+ [SecretRotation.SupabaseApiKey]: {
+ name: "Supabase API Key",
+ image: "Supabase.png",
+ size: 50
}
};
@@ -109,7 +114,8 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
[SecretRotation.DbtServiceToken]: AppConnection.Dbt,
[SecretRotation.WindowsLocalAccount]: AppConnection.SMB,
[SecretRotation.OpenRouterApiKey]: AppConnection.OpenRouter,
- [SecretRotation.HpIloLocalAccount]: AppConnection.SSH
+ [SecretRotation.HpIloLocalAccount]: AppConnection.SSH,
+ [SecretRotation.SupabaseApiKey]: AppConnection.Supabase
};
// if a rotation can potentially have downtime due to rotating a single credential set this to false
@@ -130,7 +136,8 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {
[SecretRotation.DbtServiceToken]: true,
[SecretRotation.WindowsLocalAccount]: false,
[SecretRotation.OpenRouterApiKey]: true,
- [SecretRotation.HpIloLocalAccount]: false
+ [SecretRotation.HpIloLocalAccount]: false,
+ [SecretRotation.SupabaseApiKey]: true
};
export const getRotateAtLocal = ({ hours, minutes }: TSecretRotationV2["rotateAtUtc"]) => {
diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.ts
index d7293ea08a..22cf52d8e0 100644
--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts
@@ -15,7 +15,8 @@ export enum SecretRotation {
DbtServiceToken = "dbt-service-token",
WindowsLocalAccount = "windows-local-account",
OpenRouterApiKey = "open-router-api-key",
- HpIloLocalAccount = "hp-ilo-local-account"
+ HpIloLocalAccount = "hp-ilo-local-account",
+ SupabaseApiKey = "supabase-api-key"
}
export enum SecretRotationStatus {
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
index 30c18638b0..60569f66dd 100644
--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
@@ -74,6 +74,11 @@ import {
TRedisCredentialsRotationGeneratedCredentialsResponse,
TRedisCredentialsRotationOption
} from "./redis-credentials-rotation";
+import {
+ TSupabaseApiKeyRotation,
+ TSupabaseApiKeyRotationGeneratedCredentialsResponse,
+ TSupabaseApiKeyRotationOption
+} from "./supabase-api-key-rotation";
import {
TUnixLinuxLocalAccountRotation,
TUnixLinuxLocalAccountRotationGeneratedCredentialsResponse,
@@ -103,6 +108,7 @@ export type TSecretRotationV2 = (
| TWindowsLocalAccountRotation
| TOpenRouterApiKeyRotation
| THpIloRotation
+ | TSupabaseApiKeyRotation
) & {
secrets: (SecretV3RawSanitized | null)[];
};
@@ -121,7 +127,8 @@ export type TSecretRotationV2Option =
| TDbtServiceTokenRotationOption
| TWindowsLocalAccountRotationOption
| TOpenRouterApiKeyRotationOption
- | THpIloRotationOption;
+ | THpIloRotationOption
+ | TSupabaseApiKeyRotationOption;
export type TListSecretRotationV2Options = { secretRotationOptions: TSecretRotationV2Option[] };
@@ -144,7 +151,8 @@ export type TViewSecretRotationGeneratedCredentialsResponse =
| TDbtServiceTokenRotationGeneratedCredentialsResponse
| TWindowsLocalAccountRotationGeneratedCredentialsResponse
| TOpenRouterApiKeyRotationGeneratedCredentialsResponse
- | THpIloRotationGeneratedCredentialsResponse;
+ | THpIloRotationGeneratedCredentialsResponse
+ | TSupabaseApiKeyRotationGeneratedCredentialsResponse;
export type TCreateSecretRotationV2DTO = DiscriminativePick<
TSecretRotationV2,
@@ -205,6 +213,7 @@ export type TSecretRotationOptionMap = {
[SecretRotation.WindowsLocalAccount]: TWindowsLocalAccountRotationOption;
[SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationOption;
[SecretRotation.HpIloLocalAccount]: THpIloRotationOption;
+ [SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationOption;
};
export type TSecretRotationGeneratedCredentialsResponseMap = {
@@ -225,6 +234,7 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {
[SecretRotation.WindowsLocalAccount]: TWindowsLocalAccountRotationGeneratedCredentialsResponse;
[SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationGeneratedCredentialsResponse;
[SecretRotation.HpIloLocalAccount]: THpIloRotationGeneratedCredentialsResponse;
+ [SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationGeneratedCredentialsResponse;
};
// Unified type for local account reconciliation (Unix/Linux, Windows, and HP iLO)
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/supabase-api-key-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/supabase-api-key-rotation.ts
new file mode 100644
index 0000000000..2a34cb46c1
--- /dev/null
+++ b/frontend/src/hooks/api/secretRotationsV2/types/supabase-api-key-rotation.ts
@@ -0,0 +1,42 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import {
+ TSecretRotationV2Base,
+ TSecretRotationV2GeneratedCredentialsResponseBase
+} from "@app/hooks/api/secretRotationsV2/types/shared";
+
+export enum SupabaseApiKeyType {
+ Publishable = "publishable",
+ Secret = "secret"
+}
+
+export type TSupabaseApiKeyRotation = TSecretRotationV2Base & {
+ type: SecretRotation.SupabaseApiKey;
+ parameters: {
+ projectRef: string;
+ keyType: SupabaseApiKeyType;
+ };
+ secretsMapping: {
+ apiKey: string;
+ };
+};
+
+export type TSupabaseApiKeyRotationGeneratedCredentials = {
+ apiKey: string;
+ keyId: string;
+};
+
+export type TSupabaseApiKeyRotationGeneratedCredentialsResponse =
+ TSecretRotationV2GeneratedCredentialsResponseBase<
+ SecretRotation.SupabaseApiKey,
+ TSupabaseApiKeyRotationGeneratedCredentials
+ >;
+
+export type TSupabaseApiKeyRotationOption = {
+ name: string;
+ type: SecretRotation.SupabaseApiKey;
+ connection: AppConnection.Supabase;
+ template: {
+ secretsMapping: TSupabaseApiKeyRotation["secretsMapping"];
+ };
+};