Skip to content

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

feat(pam): store session recordings in S3-compatible storage

Andreya38a00ad9929
diff --git a/backend/e2e-test/fakes/s3.ts b/backend/e2e-test/fakes/s3.ts
index 64e386747b..a315aeeaa6 100644
--- a/backend/e2e-test/fakes/s3.ts
+++ b/backend/e2e-test/fakes/s3.ts
@@ -100,6 +100,8 @@ export const createS3Bucket = ({ bucket }: Parameters<typeof RealS3.createS3Buck
};
};
+export { createS3Client } from "../../src/lib/aws/s3";
+
export const assertFakeMatchesRealS3: Pick<typeof RealS3, "createS3Bucket"> = { createS3Bucket };
export const assertFakeBucketShapeMatches: { [K in keyof RealS3.TS3Bucket]: unknown } = {
diff --git a/backend/src/ee/services/pam-account-template/pam-account-template-schemas.ts b/backend/src/ee/services/pam-account-template/pam-account-template-schemas.ts
index 678f458424..3e6e83d102 100644
--- a/backend/src/ee/services/pam-account-template/pam-account-template-schemas.ts
+++ b/backend/src/ee/services/pam-account-template/pam-account-template-schemas.ts
@@ -21,7 +21,8 @@ export const DEFAULT_HEARTBEAT_CONFIG: TPamHeartbeatConfig = { enabled: true, in
export const PamRecordingS3ConfigSchema = z.object({
bucket: z.string().trim().min(1),
- region: z.nativeEnum(AWSRegion),
+ // S3-compatible connections take the region from their endpoint
+ region: z.nativeEnum(AWSRegion).optional(),
keyPrefix: z.string().trim().optional()
});
diff --git a/backend/src/ee/services/pam-account-template/pam-account-template-service.ts b/backend/src/ee/services/pam-account-template/pam-account-template-service.ts
index 8c2faba613..840fe2012d 100644
--- a/backend/src/ee/services/pam-account-template/pam-account-template-service.ts
+++ b/backend/src/ee/services/pam-account-template/pam-account-template-service.ts
@@ -119,7 +119,8 @@ export const pamAccountTemplateServiceFactory = (deps: TPamAccountTemplateServic
if (isS3Backend && (!recordingConnectionId || !resolvedS3Config)) {
throw new BadRequestError({
- message: "S3 storage backend requires an AWS connection and valid S3 bucket configuration"
+ message:
+ "S3 storage backend requires an AWS or S3-Compatible Storage connection and valid S3 bucket configuration"
});
}
diff --git a/backend/src/ee/services/pam-session-recording/aws-s3/aws-s3-provider-factory.ts b/backend/src/ee/services/pam-session-recording/aws-s3/aws-s3-provider-factory.ts
index b18d0fcb27..509b17a002 100644
--- a/backend/src/ee/services/pam-session-recording/aws-s3/aws-s3-provider-factory.ts
+++ b/backend/src/ee/services/pam-session-recording/aws-s3/aws-s3-provider-factory.ts
@@ -1,17 +1,23 @@
import {
+ DeleteObjectCommand,
DeleteObjectsCommand,
GetObjectCommand,
HeadBucketCommand,
ListObjectsV2Command,
PutObjectCommand,
- S3Client
+ S3ServiceException
} from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
-import { CustomAWSHasher } from "@app/lib/aws/hashing";
+import { createS3Client } from "@app/lib/aws/s3";
import { crypto } from "@app/lib/crypto/cryptography";
import { BadRequestError } from "@app/lib/errors";
import { logger } from "@app/lib/logger";
+import { AppConnection, AWSRegion } from "@app/services/app-connection/app-connection-enums";
+import { TAppConnection } from "@app/services/app-connection/app-connection-types";
+import { getAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-fns";
+import { TAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-types";
+import { getS3CompatibleConnectionConfig } from "@app/services/app-connection/s3-compatible";
import { PAM_RECORDING_MAX_CHUNK_BYTES, PAM_RECORDING_PRESIGNED_URL_EXPIRY_SECONDS } from "../pam-recording-constants";
import {
@@ -21,31 +27,53 @@ import {
TPamRecordingStorageProvider
} from "../pam-recording-storage-types";
+export const PAM_RECORDING_CONNECTION_APPS = [AppConnection.AWS, AppConnection.S3Compatible];
+
+export const resolveS3RecordingAccess = async (
+ appConnection: TAppConnection,
+ region: string | undefined
+): Promise<Pick<TPamRecordingResolvedConfig, "region" | "endpoint" | "awsCredentials">> => {
+ if (appConnection.app === AppConnection.S3Compatible) {
+ const s3Config = getS3CompatibleConnectionConfig(appConnection);
+ return { region: s3Config.region, endpoint: s3Config.endpoint, awsCredentials: s3Config.credentials };
+ }
+
+ if (appConnection.app !== AppConnection.AWS) {
+ throw new BadRequestError({
+ message: "Recording connection must be an AWS or S3-Compatible Storage connection"
+ });
+ }
+
+ if (!region) {
+ throw new BadRequestError({ message: "Select the AWS region of the recording bucket" });
+ }
+
+ const awsConfig = await getAwsConnectionConfig(appConnection as unknown as TAwsConnectionConfig, region as AWSRegion);
+ return { region, awsCredentials: awsConfig.credentials };
+};
+
const buildClient = (config: TPamRecordingResolvedConfig) => {
if (!config.region || !config.awsCredentials) {
- throw new BadRequestError({ message: "AWS S3 storage backend requires region and credentials" });
+ throw new BadRequestError({ message: "S3 storage backend requires region and credentials" });
}
- return new S3Client({
- region: config.region,
- useFipsEndpoint: crypto.isFipsModeEnabled(),
- sha256: CustomAWSHasher,
- credentials: config.awsCredentials
- });
+ return createS3Client({ region: config.region, endpoint: config.endpoint, credentials: config.awsCredentials });
};
export const AwsS3RecordingStorageProvider: TPamRecordingStorageProvider = () => ({
validateConfig: async ({ config }) => {
if (!config.bucket) {
- throw new BadRequestError({ message: "Bucket is required for AWS S3 backend" });
+ throw new BadRequestError({ message: "Bucket is required for S3 storage backend" });
}
const client = buildClient(config);
try {
await client.send(new HeadBucketCommand({ Bucket: config.bucket }));
} catch (err) {
logger.warn({ err, bucket: config.bucket }, `S3 HeadBucket failed [bucket=${config.bucket}]`);
- throw new BadRequestError({
- message: `Unable to access bucket. Verify region, credentials, and bucket policy [bucket=${config.bucket}]`
- });
+ if (!(err instanceof S3ServiceException && err.$metadata.httpStatusCode === 403)) {
+ throw new BadRequestError({
+ message: `Unable to access bucket. Verify ${config.endpoint ? "" : "region, "}credentials, and bucket policy [bucket=${config.bucket}]`
+ });
+ }
}
const testKey = `${normalizeKeyPrefix(config.keyPrefix)}.test/${crypto.nativeCrypto.randomUUID()}`;
@@ -67,12 +95,7 @@ export const AwsS3RecordingStorageProvider: TPamRecordingStorageProvider = () =>
}
try {
- await client.send(
- new DeleteObjectsCommand({
- Bucket: config.bucket,
- Delete: { Objects: [{ Key: testKey }], Quiet: true }
- })
- );
+ await client.send(new DeleteObjectCommand({ Bucket: config.bucket, Key: testKey }));
} catch (err) {
logger.warn({ err, bucket: config.bucket, testKey }, `S3 test object cleanup failed [testKey=${testKey}]`);
}
diff --git a/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts b/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts
index 1b2bcda7fa..f69917442a 100644
--- a/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts
+++ b/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts
@@ -5,10 +5,7 @@ import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/
import { logger } from "@app/lib/logger";
import { OrgServiceActor } from "@app/lib/types";
import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";
-import { AWSRegion } from "@app/services/app-connection/app-connection-enums";
import { decryptAppConnection } from "@app/services/app-connection/app-connection-fns";
-import { getAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-fns";
-import { TAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-types";
import { ActorType } from "@app/services/auth/auth-type";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
@@ -21,6 +18,7 @@ import {
} from "../pam-account-template/pam-account-template-schemas";
import { TPamSessionDALFactory } from "../pam-session/pam-session-dal";
import { ResourcePermissionPamResourceActions } from "../permission/resource-permission";
+import { resolveS3RecordingAccess } from "./aws-s3/aws-s3-provider-factory";
import { TPamSessionEventChunkDALFactory } from "./pam-recording-chunk-dal";
import { PAM_RECORDING_MAX_CHUNK_BYTES } from "./pam-recording-constants";
import { PamRecordingStorageBackend } from "./pam-recording-enums";
@@ -80,17 +78,12 @@ export const pamSessionChunkServiceFactory = ({
}
const appConnection = await decryptAppConnection(raw, kmsService);
- const awsConfig = await getAwsConnectionConfig(
- appConnection as unknown as TAwsConnectionConfig,
- (s3Config.region as AWSRegion) ?? AWSRegion.US_EAST_1
- );
return {
backend: PamRecordingStorageBackend.AwsS3,
bucket: s3Config.bucket,
- region: s3Config.region as AWSRegion,
keyPrefix: s3Config.keyPrefix ?? null,
- awsCredentials: awsConfig.credentials
+ ...(await resolveS3RecordingAccess(appConnection, s3Config.region))
};
}
diff --git a/backend/src/ee/services/pam-session-recording/pam-recording-storage-types.ts b/backend/src/ee/services/pam-session-recording/pam-recording-storage-types.ts
index ed1de23708..dc1afa6b70 100644
--- a/backend/src/ee/services/pam-session-recording/pam-recording-storage-types.ts
+++ b/backend/src/ee/services/pam-session-recording/pam-recording-storage-types.ts
@@ -1,5 +1,3 @@
-import { AWSRegion } from "@app/services/app-connection/app-connection-enums";
-
import { PamRecordingStorageBackend } from "./pam-recording-enums";
export type TPamRecordingChunkRef = {
@@ -11,7 +9,8 @@ export type TPamRecordingChunkRef = {
export type TPamRecordingResolvedConfig = {
backend: PamRecordingStorageBackend;
bucket?: string;
- region?: AWSRegion;
+ region?: string;
+ endpoint?: string;
keyPrefix?: string | null;
awsCredentials?: {
diff --git a/backend/src/ee/services/pam/CLAUDE.md b/backend/src/ee/services/pam/CLAUDE.md
index c78323537d..c9cf57332e 100644
--- a/backend/src/ee/services/pam/CLAUDE.md
+++ b/backend/src/ee/services/pam/CLAUDE.md
@@ -176,6 +176,10 @@ policies apply before the session starts; gateway-enforced ones flow to the gate
**Settings** (recording, password constraints, log masking) are a separate concept — they live in the
template's `settings` column, not `policies`. Both are edited on the template detail sheet's "General" tab.
+**External recording storage** is the `aws-s3` backend whether the connection is AWS or S3-Compatible Storage
+(`resolveS3RecordingAccess`). Don't add a backend per provider: the value is in each chunk's AAD and in the
+backend list gateways read.
+
**Break-glass** lets a requester self-approve their own pending request, and needs **both** gates open:
the account's template carries `allow-break-glass`, *and* the folder's approval policy names the actor in
`approval_policy_bypassers`. Neither alone is sufficient, and an empty bypasser list means **nobody** —
diff --git a/backend/src/ee/services/pam/pam-validators.ts b/backend/src/ee/services/pam/pam-validators.ts
index c36d7901f7..3caa484d18 100644
--- a/backend/src/ee/services/pam/pam-validators.ts
+++ b/backend/src/ee/services/pam/pam-validators.ts
@@ -12,14 +12,16 @@ import {
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";
import { BadRequestError, NotFoundError } from "@app/lib/errors";
import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";
-import { AppConnection, AWSRegion } from "@app/services/app-connection/app-connection-enums";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { decryptAppConnection } from "@app/services/app-connection/app-connection-fns";
-import { getAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-fns";
-import { TAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-types";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { TOrgDALFactory } from "@app/services/org/org-dal";
import { TPamAccountSettingsOverrides } from "../pam-account-template/pam-account-template-schemas";
+import {
+ PAM_RECORDING_CONNECTION_APPS,
+ resolveS3RecordingAccess
+} from "../pam-session-recording/aws-s3/aws-s3-provider-factory";
import { PamRecordingStorageBackend } from "../pam-session-recording/pam-recording-enums";
import { PAM_RECORDING_STORAGE_FACTORY_MAP } from "../pam-session-recording/pam-recording-storage-factory";
import { normalizeKeyPrefix, TPamRecordingResolvedConfig } from "../pam-session-recording/pam-recording-storage-types";
@@ -93,8 +95,10 @@ const enforceAppConnectionConnect = async (
throw new NotFoundError({ message: "Recording connection not found" });
}
- if (conn.app !== AppConnection.AWS) {
- throw new BadRequestError({ message: "Recording connection must be an AWS connection" });
+ if (!PAM_RECORDING_CONNECTION_APPS.includes(conn.app as AppConnection)) {
+ throw new BadRequestError({
+ message: "Recording connection must be an AWS or S3-Compatible Storage connection"
+ });
}
if (conn.orgId !== ctx.actorOrgId) {
@@ -136,23 +140,18 @@ export const validateRecordingConnection = async (
export const validateRecordingS3Config = async (
deps: Pick<TPamValidatorDeps, "permissionService" | "appConnectionDAL" | "kmsService">,
connectionId: string,
- s3Config: { bucket: string; region: string; keyPrefix?: string },
+ s3Config: { bucket: string; region?: string; keyPrefix?: string },
ctx: TActorContext
): Promise<TPamRecordingResolvedConfig> => {
const raw = await enforceAppConnectionConnect(deps, connectionId, ctx);
const appConnection = await decryptAppConnection(raw, deps.kmsService);
- const awsConfig = await getAwsConnectionConfig(
- appConnection as unknown as TAwsConnectionConfig,
- (s3Config.region as AWSRegion) ?? AWSRegion.US_EAST_1
- );
const resolvedConfig: TPamRecordingResolvedConfig = {
backend: PamRecordingStorageBackend.AwsS3,
bucket: s3Config.bucket,
- region: s3Config.region as AWSRegion,
keyPrefix: s3Config.keyPrefix ?? null,
- awsCredentials: awsConfig.credentials
+ ...(await resolveS3RecordingAccess(appConnection, s3Config.region))
};
const provider = PAM_RECORDING_STORAGE_FACTORY_MAP[PamRecordingStorageBackend.AwsS3]();
@@ -171,7 +170,7 @@ export const resolveOverridesS3Config = async (
if (!effectiveConnectionId) {
throw new BadRequestError({
- message: "S3 recording config requires an AWS connection on the account or template"
+ message: "S3 recording config requires an AWS or S3-Compatible Storage connection on the account or template"
});
}
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 12241e184e..818d390a4c 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -3121,6 +3121,12 @@ export const AppConnections = {
apiUrl: "The Spacelift API URL to connect with (e.g., 'https://mycorp.app.spacelift.io').",
apiKeyId: "The API Key ID used to authenticate with Spacelift.",
apiKeySecret: "The API Key Secret used to authenticate with Spacelift."
+ },
+ S3_COMPATIBLE: {
+ endpoint:
+ "The S3 API endpoint of the storage provider, without a bucket name: 'https://s3.<region>.amazonaws.com' (AWS S3), 'https://<account-id>.r2.cloudflarestorage.com' (Cloudflare R2), 'https://storage.googleapis.com' (Google Cloud Storage), or 'https://<namespace>.compat.objectstorage.<region>.oraclecloud.com' (OCI Object Storage).",
+ accessKeyId: "The Access Key ID used to authenticate with the storage provider.",
+ secretAccessKey: "The Secret Access Key used to authenticate with the storage provider."
}
}
};
diff --git a/backend/src/lib/aws/s3.ts b/backend/src/lib/aws/s3.ts
index 28f2fc1bd1..ff1fcfde78 100644
--- a/backend/src/lib/aws/s3.ts
+++ b/backend/src/lib/aws/s3.ts
@@ -11,6 +11,30 @@ export type TS3AccessCheck = { ok: true } | { ok: false; failure: "unreachable"
export type TS3Bucket = ReturnType<typeof createS3Bucket>;
+export const createS3Client = ({
+ region,
+ credentials,
+ endpoint
+}: {
+ region: string;
+ credentials: TS3Credentials;
+ endpoint?: string;
+}) =>
+ new S3Client({
+ region,
+ sha256: CustomAWSHasher,
+ credentials,
+ ...(endpoint
+ ? {
+ endpoint,
+ forcePathStyle: true,
+ // not every S3-compatible provider accepts the SDK's default flexible checksums
+ requestChecksumCalculation: "WHEN_REQUIRED",
+ responseChecksumValidation: "WHEN_REQUIRED"
+ }
+ : { useFipsEndpoint: crypto.isFipsModeEnabled() })
+ });
+
export const createS3Bucket = ({
region,
bucket,
@@ -20,12 +44,7 @@ export const createS3Bucket = ({
bucket: string;
credentials: TS3Credentials;
}) => {
- const client = new S3Client({
- region,
- useFipsEndpoint: crypto.isFipsModeEnabled(),
- sha256: CustomAWSHasher,
- credentials
- });
+ const client = createS3Client({ region, credentials });
// These headers are signed so S3 enforces them: the body must be the declared size and hash to the declared
// digest, and If-None-Match stops a re-minted link from overwriting an object already stored.
diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
index 3ba62f659a..d9d12bca1d 100644
--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
@@ -218,6 +218,10 @@ import {
RundeckConnectionListItemSchema,
SanitizedRundeckConnectionSchema
} from "@app/services/app-connection/rundeck";
+import {
+ S3CompatibleConnectionListItemSchema,
+ SanitizedS3CompatibleConnectionSchema
+} from "@app/services/app-connection/s3-compatible";
import {
SalesforceConnectionListItemSchema,
SanitizedSalesforceConnectionSchema
@@ -357,7 +361,8 @@ const SanitizedAppConnectionSchema = z.union([
...SanitizedPowerDnsConnectionSchema.options,
...SanitizedSpaceliftConnectionSchema.options,
...SanitizedDaytonaConnectionSchema.options,
- ...SanitizedStripeConnectionSchema.options
+ ...SanitizedStripeConnectionSchema.options,
+ ...SanitizedS3CompatibleConnectionSchema.options
]);
const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
@@ -446,7 +451,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
PowerDnsConnectionListItemSchema,
SpaceliftConnectionListItemSchema,
DaytonaConnectionListItemSchema,
- StripeConnectionListItemSchema
+ StripeConnectionListItemSchema,
+ S3CompatibleConnectionListItemSchema
]);
export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.ts
index 4b5b83f01a..27ecea8186 100644
--- a/backend/src/server/routes/v1/app-connection-routers/index.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts
@@ -69,6 +69,7 @@ import { registerRailwayConnectionRouter } from "./railway-connection-router";
import { registerRedisConnectionRouter } from "./redis-connection-router";
import { registerRenderConnectionRouter } from "./render-connection-router";
import { registerRundeckConnectionRouter } from "./rundeck-connection-router";
+import { registerS3CompatibleConnectionRouter } from "./s3-compatible-connection-router";
import { registerSalesforceConnectionRouter } from "./salesforce-connection-router";
import { registerSmbConnectionRouter } from "./smb-connection-router";
import { registerSnowflakeConnectionRouter } from "./snowflake-connection-router";
@@ -176,5 +177,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
[AppConnection.NutanixPrismCentral]: registerNutanixPrismCentralConnectionRouter,
[AppConnection.Spacelift]: registerSpaceliftConnectionRouter,
[AppConnection.Daytona]: registerDaytonaConnectionRouter,
- [AppConnection.Stripe]: registerStripeConnectionRouter
+ [AppConnection.Stripe]: registerStripeConnectionRouter,
+ [AppConnection.S3Compatible]: registerS3CompatibleConnectionRouter
};
diff --git a/backend/src/server/routes/v1/app-connection-routers/s3-compatible-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/s3-compatible-connection-router.ts
new file mode 100644
index 0000000000..844374b619
--- /dev/null
+++ b/backend/src/server/routes/v1/app-connection-routers/s3-compatible-connection-router.ts
@@ -0,0 +1,18 @@
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ CreateS3CompatibleConnectionSchema,
+ SanitizedS3CompatibleConnectionSchema,
+ UpdateS3CompatibleConnectionSchema
+} from "@app/services/app-connection/s3-compatible";
+
+import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
+
+export const registerS3CompatibleConnectionRouter = async (server: FastifyZodProvider) => {
+ registerAppConnectionEndpoints({
+ app: AppConnection.S3Compatible,
+ server,
+ sanitizedResponseSchema: SanitizedS3CompatibleConnectionSchema,
+ createSchema: CreateS3CompatibleConnectionSchema,
+ updateSchema: UpdateS3CompatibleConnectionSchema
+ });
+};
diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.ts
index dec249530e..492c662bca 100644
--- a/backend/src/services/app-connection/app-connection-enums.ts
+++ b/backend/src/services/app-connection/app-connection-enums.ts
@@ -84,7 +84,8 @@ export enum AppConnection {
PowerDns = "powerdns",
Spacelift = "spacelift",
Daytona = "daytona",
- Stripe = "stripe"
+ Stripe = "stripe",
+ S3Compatible = "s3-compatible"
}
export enum AWSRegion {
diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.ts
index e287e67300..975f5d2fa6 100644
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@ -250,6 +250,11 @@ import { getRedisConnectionListItem, RedisConnectionMethod, validateRedisConnect
import { RenderConnectionMethod } from "./render/render-connection-enums";
import { getRenderConnectionListItem, validateRenderConnectionCredentials } from "./render/render-connection-fns";
import { getRundeckConnectionListItem, RundeckConnectionMethod, validateRundeckConnectionCredentials } from "./rundeck";
+import {
+ getS3CompatibleConnectionListItem,
+ S3CompatibleConnectionMethod,
+ validateS3CompatibleConnectionCredentials
+} from "./s3-compatible";
import {
getSalesforceConnectionListItem,
SalesforceConnectionMethod,
@@ -465,7 +470,8 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {
getPowerDnsConnectionListItem(),
getSpaceliftConnectionListItem(),
getDaytonaConnectionListItem(),
- getStripeConnectionListItem()
+ getStripeConnectionListItem(),
+ getS3CompatibleConnectionListItem()
]
.filter((option) => isAppConnectionAllowedInProject(option.app, projectType))
.sort((a, b) => a.name.localeCompare(b.name));
@@ -701,7 +707,8 @@ export const validateAppConnectionCredentials = async (
[AppConnection.PowerDns]: validatePowerDnsConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Spacelift]: validateSpaceliftConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Daytona]: validateDaytonaConnectionCredentials as TAppConnectionCredentialsValidator,
- [AppConnection.Stripe]: validateStripeConnectionCredentials as TAppConnectionCredentialsValidator
+ [AppConnection.Stripe]: validateStripeConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.S3Compatible]: validateS3CompatibleConnectionCredentials as TAppConnectionCredentialsValidator
};
return VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection, gatewayV2Service);
@@ -731,6 +738,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
return "Auth Token";
case AwsConnectionMethod.AccessKey:
case OCIConnectionMethod.AccessKey:
+ case S3CompatibleConnectionMethod.AccessKey:
return "Access Key";
case AwsConnectionMethod.AssumeRole:
return "Assume Role";
@@ -977,7 +985,8 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
[AppConnection.PowerDns]: platformManagedCredentialsNotSupported,
[AppConnection.Spacelift]: platformManagedCredentialsNotSupported,
[AppConnection.Daytona]: platformManagedCredentialsNotSupported,
- [AppConnection.Stripe]: platformManagedCredentialsNotSupported
+ [AppConnection.Stripe]: platformManagedCredentialsNotSupported,
+ [AppConnection.S3Compatible]: platformManagedCredentialsNotSupported
};
export const enterpriseAppCheck = async (
diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.ts
index e9fcc867fe..ad68c0fb61 100644
--- a/backend/src/services/app-connection/app-connection-maps.ts
+++ b/backend/src/services/app-connection/app-connection-maps.ts
@@ -86,7 +86,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
[AppConnection.Spacelift]: "Spacelift",
[AppConnection.Daytona]: "Daytona",
[AppConnection.MicrosoftIntune]: "Microsoft Intune",
- [AppConnection.Stripe]: "Stripe"
+ [AppConnection.Stripe]: "Stripe",
+ [AppConnection.S3Compatible]: "S3-Compatible Storage"
};
export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {
@@ -175,5 +176,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
[AppConnection.Spacelift]: AppConnectionPlanType.Regular,
[AppConnection.Daytona]: AppConnectionPlanType.Regular,
[AppConnection.MicrosoftIntune]: AppConnectionPlanType.Enterprise,
- [AppConnection.Stripe]: AppConnectionPlanType.Regular
+ [AppConnection.Stripe]: AppConnectionPlanType.Regular,
+ [AppConnection.S3Compatible]: AppConnectionPlanType.Regular
};
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index 1c1ef18aa5..8d7de842b2 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -178,6 +178,7 @@ import { ValidateRenderConnectionCredentialsSchema } from "./render/render-conne
import { renderConnectionService } from "./render/render-connection-service";
import { ValidateRundeckConnectionCredentialsSchema } from "./rundeck";
import { rundeckConnectionService } from "./rundeck/rundeck-connection-service";
+import { ValidateS3CompatibleConnectionCredentialsSchema } from "./s3-compatible";
import { ValidateSalesforceConnectionCredentialsSchema } from "./salesforce";
import { salesforceConnectionService } from "./salesforce/salesforce-connection-service";
import { ValidateSmbConnectionCredentialsSchema } from "./smb";
@@ -318,7 +319,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
[AppConnection.PowerDns]: ValidatePowerDnsConnectionCredentialsSchema,
[AppConnection.Spacelift]: ValidateSpaceliftConnectionCredentialsSchema,
[AppConnection.Daytona]: ValidateDaytonaConnectionCredentialsSchema,
- [AppConnection.Stripe]: ValidateStripeConnectionCredentialsSchema
+ [AppConnection.Stripe]: ValidateStripeConnectionCredentialsSchema,
+ [AppConnection.S3Compatible]: ValidateS3CompatibleConnectionCredentialsSchema
};
export const appConnectionServiceFactory = ({
diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.ts
index 9fdee4dceb..721914d70e 100644
--- a/backend/src/services/app-connection/app-connection-types.ts
+++ b/backend/src/services/app-connection/app-connection-types.ts
@@ -406,6 +406,12 @@ import {
TRundeckConnectionInput,
TValidateRundeckConnectionCredentialsSchema
} from "./rundeck";
+import {
+ TS3CompatibleConnection,
+ TS3CompatibleConnectionConfig,
+ TS3CompatibleConnectionInput,
+ TValidateS3CompatibleConnectionCredentialsSchema
+} from "./s3-compatible";
import {
TSalesforceConnection,
TSalesforceConnectionConfig,
@@ -598,6 +604,7 @@ export type TAppConnection = { id: string; configuration?: TAppConnectionConfigu
| TSpaceliftConnection
| TDaytonaConnection
| TStripeConnection
+ | TS3CompatibleConnection
);
export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;
@@ -695,6 +702,7 @@ export type TAppConnectionInput = { id: string } & (
| TSpaceliftConnectionInput
| TDaytonaConnectionInput
| TStripeConnectionInput
+ | TS3CompatibleConnectionInput
);
export type TSqlConnectionInput =
@@ -825,7 +833,8 @@ export type TAppConnectionConfig =
| TPowerDnsConnectionConfig
| TSpaceliftConnectionConfig
| TDaytonaConnectionConfig
- | TStripeConnectionConfig;
+ | TStripeConnectionConfig
+ | TS3CompatibleConnectionConfig;
export type TValidateAppConnectionCredentialsSchema =
| TValidateAwsConnectionCredentialsSchema
@@ -913,7 +922,8 @@ export type TValidateAppConnectionCredentialsSchema =
| TValidatePowerDnsConnectionCredentialsSchema
| TValidateSpaceliftConnectionCredentialsSchema
| TValidateDaytonaConnectionCredentialsSchema
- | TValidateStripeConnectionCredentialsSchema;
+ | TValidateStripeConnectionCredentialsSchema
+ | TValidateS3CompatibleConnectionCredentialsSchema;
export type TListAwsConnectionKmsKeys = {
connectionId: string;
diff --git a/backend/src/services/app-connection/s3-compatible/index.ts b/backend/src/services/app-connection/s3-compatible/index.ts
new file mode 100644
index 0000000000..4fd0399064
--- /dev/null
+++ b/backend/src/services/app-connection/s3-compatible/index.ts
@@ -0,0 +1,19 @@
+export { S3CompatibleConnectionMethod } from "./s3-compatible-connection-enums";
+export {
+ getS3CompatibleConnectionConfig,
+ getS3CompatibleConnectionListItem,
+ validateS3CompatibleConnectionCredentials
+} from "./s3-compatible-connection-fns";
+export {
+ CreateS3CompatibleConnectionSchema,
+ S3CompatibleConnectionListItemSchema,
+ SanitizedS3CompatibleConnectionSchema,
+ UpdateS3CompatibleConnectionSchema,
+ ValidateS3CompatibleConnectionCredentialsSchema
+} from "./s3-compatible-connection-schemas";
+export type {
+ TS3CompatibleConnection,
+ TS3CompatibleConnectionConfig,
+ TS3CompatibleConnectionInput,
+ TValidateS3CompatibleConnectionCredentialsSchema
+} from "./s3-compatible-connection-types";
diff --git a/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-enums.ts b/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-enums.ts
new file mode 100644
index 0000000000..1beb68e11b
--- /dev/null
+++ b/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-enums.ts
@@ -0,0 +1,10 @@
+export enum S3CompatibleConnectionMethod {
+ AccessKey = "access-key"
+}
+
+export enum S3CompatibleProvider {
+ AwsS3 = "aws-s3",
+ CloudflareR2 = "cloudflare-r2",
+ GoogleCloudStorage = "google-cloud-storage",
+ OciObjectStorage = "oci-object-storage"
+}
diff --git a/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-fns.ts b/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-fns.ts
new file mode 100644
index 0000000000..59a6170232
--- /dev/null
+++ b/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-fns.ts
@@ -0,0 +1,82 @@
+import { ListBucketsCommand, S3ServiceException } from "@aws-sdk/client-s3";
+
+import { createS3Client } from "@app/lib/aws/s3";
+import { BadRequestError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
+
+import { AppConnection } from "../app-connection-enums";
+import { S3CompatibleConnectionMethod, S3CompatibleProvider } from "./s3-compatible-connection-enums";
+import { parseS3CompatibleEndpoint, S3_COMPATIBLE_PROVIDER_MAP } from "./s3-compatible-connection-schemas";
+import { TS3CompatibleConnectionConfig } from "./s3-compatible-connection-types";
+
+const REJECTED_KEY_ERROR_CODES = new Set([
+ "invalidaccesskeyid",
+ "invalidargument",
+ "signaturedoesnotmatch",
+ "authorizationheadermalformed",
+ "invalidsecurity",
+ "unauthorized"
+]);
+
+export const getS3CompatibleConnectionListItem = () => {
+ return {
+ name: "S3-Compatible Storage" as const,
+ app: AppConnection.S3Compatible as const,
+ methods: Object.values(S3CompatibleConnectionMethod) as [S3CompatibleConnectionMethod.AccessKey]
+ };
+};
+
+export const getS3CompatibleConnectionConfig = ({
+ credentials
+}: {
+ credentials: TS3CompatibleConnectionConfig["credentials"];
+}) => {
+ const parsed = parseS3CompatibleEndpoint(credentials.endpoint);
+ if (!parsed) {
+ throw new BadRequestError({
+ message: "The S3-Compatible Storage connection's endpoint is not supported. Update the connection's endpoint."
+ });
+ }
+
+ return {
+ provider: parsed.provider,
+ region: parsed.region,
+ endpoint: parsed.provider === S3CompatibleProvider.AwsS3 ? undefined : parsed.origin,
+ credentials: { accessKeyId: credentials.accessKeyId, secretAccessKey: credentials.secretAccessKey }
+ };
+};
+
+export const validateS3CompatibleConnectionCredentials = async (config: TS3CompatibleConnectionConfig) => {
+ const { provider, ...clientConfig } = getS3CompatibleConnectionConfig(config);
+ const providerName = S3_COMPATIBLE_PROVIDER_MAP[provider].name;
+
+ try {
+ await createS3Client(clientConfig).send(new ListBucketsCommand({}));
+ } catch (error) {
+ // keys scoped to a bucket can't list buckets, so only a rejected key fails here
+ if (
+ error instanceof S3ServiceException &&
+ !REJECTED_KEY_ERROR_CODES.has(error.name.toLowerCase()) &&
+ error.$metadata?.httpStatusCode !== 401
+ ) {
+ return config.credentials;
+ }
+
+ logger.warn(
+ { err: error },
+ `S3-Compatible Storage credential check failed [orgId=${config.orgId}] [provider=${provider}]`
+ );
+
+ if (error instanceof S3ServiceException) {
+ throw new BadRequestError({
+ message: `${providerName} rejected the access key: ${error.message || error.name}`
+ });
+ }
+
+ throw new BadRequestError({
+ message: `Could not reach ${providerName} at the configured endpoint. Verify the endpoint and try again.`
+ });
+ }
+
+ return config.credentials;
+};
diff --git a/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-schemas.ts b/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-schemas.ts
new file mode 100644
index 0000000000..a1d8a2212f
--- /dev/null
+++ b/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-schemas.ts
@@ -0,0 +1,155 @@
+import RE2 from "re2";
+import z from "zod";
+
+import { AppConnections } from "@app/lib/api-docs";
+import { AppConnection, AWSRegion } from "@app/services/app-connection/app-connection-enums";
+import {
+ BaseAppConnectionSchema,
+ GenericCreateAppConnectionFieldsSchema,
+ GenericUpdateAppConnectionFieldsSchema
+} from "@app/services/app-connection/app-connection-schemas";
+
+import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";
+import { S3CompatibleConnectionMethod, S3CompatibleProvider } from "./s3-compatible-connection-enums";
+
+const AWS_S3_HOSTNAME = new RE2(/^s3\.([a-z0-9-]+)\.amazonaws\.com$/);
+// the optional label is the bucket jurisdiction (eu, us, fedramp)
+const R2_HOSTNAME = new RE2(/^[a-f0-9]{32}(\.[a-z]+)?\.r2\.cloudflarestorage\.com$/);
+const OCI_HOSTNAME = new RE2(
+ /^[a-z0-9-]+\.compat\.objectstorage\.([a-z0-9-]+)\.(?:oraclecloud\.com|oci\.customer-oci\.com)$/
+);
+
+export const S3_COMPATIBLE_PROVIDER_MAP: Record<
+ S3CompatibleProvider,
+ {
+ name: string;
+ endpointExample: string;
+ getSigningRegion: (hostname: string) => string | null;
+ }
+> = {
+ [S3CompatibleProvider.AwsS3]: {
+ name: "AWS S3",
+ endpointExample: "https://s3.<region>.amazonaws.com",
+ getSigningRegion: (hostname) => {
+ const region = AWS_S3_HOSTNAME.exec(hostname)?.[1];
+ return region && (Object.values(AWSRegion) as string[]).includes(region) ? region : null;
+ }
+ },
+ [S3CompatibleProvider.CloudflareR2]: {
+ name: "Cloudflare R2",
+ endpointExample: "https://<account-id>.r2.cloudflarestorage.com",
+ getSigningRegion: (hostname) => (R2_HOSTNAME.test(hostname) ? "auto" : null)
+ },
+ [S3CompatibleProvider.GoogleCloudStorage]: {
+ name: "Google Cloud Storage",
+ endpointExample: "https://storage.googleapis.com",
+ getSigningRegion: (hostname) => (hostname === "storage.googleapis.com" ? "auto" : null)
+ },
+ [S3CompatibleProvider.OciObjectStorage]: {
+ name: "OCI Object Storage",
+ endpointExample: "https://<namespace>.compat.objectstorage.<region>.oraclecloud.com",
+ getSigningRegion: (hostname) => OCI_HOSTNAME.exec(hostname)?.[1] ?? null
+ }
+};
+
+export const parseS3CompatibleEndpoint = (endpoint: string) => {
+ let url: URL;
+ try {
+ url = new URL(endpoint);
+ } catch {
+ return null;
+ }
+
+ if (
+ url.protocol !== "https:" ||
+ url.port ||
+ url.username ||
+ url.password ||
+ url.pathname !== "/" ||
+ url.search ||
+ url.hash
+ ) {
+ return null;
+ }
+
+ for (const provider of Object.values(S3CompatibleProvider)) {
+ const region = S3_COMPATIBLE_PROVIDER_MAP[provider].getSigningRegion(url.hostname);
+ if (region) return { provider, region, origin: url.origin };
+ }
+ return null;
+};
+
+const S3_COMPATIBLE_ENDPOINT_ERROR = `Endpoint must be the S3 API endpoint of a supported provider, without a bucket name: ${Object.values(
+ S3_COMPATIBLE_PROVIDER_MAP
+)
+ .map(({ name, endpointExample }) => `${endpointExample} (${name})`)
+ .join(", ")}`;
+
+export const S3CompatibleConnectionAccessKeyCredentialsSchema = z.object({
+ endpoint: z
+ .string()
+ .trim()
+ .min(1, "Endpoint required")
+ .max(256, "Endpoint cannot exceed 256 characters")
+ .refine((endpoint) => Boolean(parseS3CompatibleEndpoint(endpoint)), S3_COMPATIBLE_ENDPOINT_ERROR)
+ .describe(AppConnections.CREDENTIALS.S3_COMPATIBLE.endpoint),
+ accessKeyId: z
+ .string()
+ .trim()
+ .min(1, "Access Key ID required")
+ .max(256, "Access Key ID cannot exceed 256 characters")
+ .describe(AppConnections.CREDENTIALS.S3_COMPATIBLE.accessKeyId),
+ secretAccessKey: z
+ .string()
+ .trim()
+ .min(1, "Secret Access Key required")
+ .max(256, "Secret Access Key cannot exceed 256 characters")
+ .describe(AppConnections.CREDENTIALS.S3_COMPATIBLE.secretAccessKey)
+});
+
+const BaseS3CompatibleConnectionSchema = BaseAppConnectionSchema.extend({
+ app: z.literal(AppConnection.S3Compatible)
+});
+
+export const S3CompatibleConnectionSchema = BaseS3CompatibleConnectionSchema.extend({
+ method: z.literal(S3CompatibleConnectionMethod.AccessKey),
+ credentials: S3CompatibleConnectionAccessKeyCredentialsSchema
+});
+
+export const SanitizedS3CompatibleConnectionSchema = z.discriminatedUnion("method", [
+ BaseS3CompatibleConnectionSchema.extend({
+ method: z.literal(S3CompatibleConnectionMethod.AccessKey),
+ credentials: S3CompatibleConnectionAccessKeyCredentialsSchema.pick({ endpoint: true, accessKeyId: true })
+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.S3Compatible]} (Access Key)` }))
+]);
+
+export const ValidateS3CompatibleConnectionCredentialsSchema = z.discriminatedUnion("method", [
+ z.object({
+ method: z
+ .literal(S3CompatibleConnectionMethod.AccessKey)
+ .describe(AppConnections.CREATE(AppConnection.S3Compatible).method),
+ credentials: S3CompatibleConnectionAccessKeyCredentialsSchema.describe(
+ AppConnections.CREATE(AppConnection.S3Compatible).credentials
+ )
+ })
+]);
+
+export const CreateS3CompatibleConnectionSchema = ValidateS3CompatibleConnectionCredentialsSchema.and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.S3Compatible)
+);
+
+export const UpdateS3CompatibleConnectionSchema = z
+ .object({
+ credentials: S3CompatibleConnectionAccessKeyCredentialsSchema.optional().describe(
+ AppConnections.UPDATE(AppConnection.S3Compatible).credentials
+ )
+ })
+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.S3Compatible));
+
+export const S3CompatibleConnectionListItemSchema = z
+ .object({
+ name: z.literal("S3-Compatible Storage"),
+ app: z.literal(AppConnection.S3Compatible),
+ methods: z.nativeEnum(S3CompatibleConnectionMethod).array()
+ })
+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.S3Compatible] }));
diff --git a/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-types.ts b/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-types.ts
new file mode 100644
index 0000000000..ac7a9bbb7c
--- /dev/null
+++ b/backend/src/services/app-connection/s3-compatible/s3-compatible-connection-types.ts
@@ -0,0 +1,25 @@
+import z from "zod";
+
+import { DiscriminativePick } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import {
+ CreateS3CompatibleConnectionSchema,
+ S3CompatibleConnectionSchema,
+ ValidateS3CompatibleConnectionCredentialsSchema
+} from "./s3-compatible-connection-schemas";
+
+export type TS3CompatibleConnection = z.infer<typeof S3CompatibleConnectionSchema>;
+
+export type TS3CompatibleConnectionInput = z.infer<typeof CreateS3CompatibleConnectionSchema> & {
+ app: AppConnection.S3Compatible;
+};
+
+export type TValidateS3CompatibleConnectionCredentialsSchema = typeof ValidateS3CompatibleConnectionCredentialsSchema;
+
+export type TS3CompatibleConnectionConfig = DiscriminativePick<
+ TS3CompatibleConnectionInput,
+ "method" | "app" | "credentials"
+> & {
+ orgId: string;
+};
diff --git a/frontend/index.html b/frontend/index.html
index f909f8b6a7..232cf8c46a 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -12,7 +12,7 @@
style-src 'self' 'unsafe-inline' https://hcaptcha.com https://*.hcaptcha.com https://tags.srv.stackadapt.com;
child-src https://api.stripe.com;
frame-src https://js.stripe.com/ https://api.stripe.com https://www.youtube.com/ https://hcaptcha.com https://*.hcaptcha.com https://www.googletagmanager.com;
- connect-src 'self' blob: wss://nexus-websocket-a.intercom.io https://api-iam.intercom.io https://api.heroku.com/ https://id.heroku.com/oauth/authorize https://id.heroku.com/oauth/token https://checkout.stripe.com https://app.posthog.com https://*.posthog.com https://api.stripe.com https://api.pwnedpasswords.com http://127.0.0.1:* https://hcaptcha.com https://*.hcaptcha.com https://www.googletagmanager.com https://www.google-analytics.com https://region1.google-analytics.com https://analytics.google.com https://stats.g.doubleclick.net https://googleads.g.doubleclick.net https://forms.hscollectedforms.net https://forms.hubspot.com https://api.hubapi.com https://*.ads.linkedin.com https://tags.srv.stackadapt.com https://api.unifyintent.com https://pixel-config.reddit.com https://static.ads-twitter.com https://analytics.twitter.com https://cdn.jsdelivr.net/npm/@lottiefiles/[email protected]/dist/dotlottie-player.wasm https://*.s3.amazonaws.com https://*.s3.us-east-1.amazonaws.com https://*.s3.us-east-2.amazonaws.com https://*.s3.us-west-1.amazonaws.com https://*.s3.us-west-2.amazonaws.com https://*.s3.af-south-1.amazonaws.com https://*.s3.ap-east-1.amazonaws.com https://*.s3.ap-south-1.amazonaws.com https://*.s3.ap-south-2.amazonaws.com https://*.s3.ap-southeast-1.amazonaws.com https://*.s3.ap-southeast-2.amazonaws.com https://*.s3.ap-southeast-3.amazonaws.com https://*.s3.ap-southeast-4.amazonaws.com https://*.s3.ap-northeast-1.amazonaws.com https://*.s3.ap-northeast-2.amazonaws.com https://*.s3.ap-northeast-3.amazonaws.com https://*.s3.ca-central-1.amazonaws.com https://*.s3.eu-central-1.amazonaws.com https://*.s3.eu-central-2.amazonaws.com https://*.s3.eu-west-1.amazonaws.com https://*.s3.eu-west-2.amazonaws.com https://*.s3.eu-west-3.amazonaws.com https://*.s3.eu-south-1.amazonaws.com https://*.s3.eu-south-2.amazonaws.com https://*.s3.eu-north-1.amazonaws.com https://*.s3.me-south-1.amazonaws.com https://*.s3.me-central-1.amazonaws.com https://*.s3.sa-east-1.amazonaws.com https://*.s3.us-gov-east-1.amazonaws.com https://*.s3.us-gov-west-1.amazonaws.com https://s3.amazonaws.com https://s3.us-east-1.amazonaws.com https://s3.us-east-2.amazonaws.com https://s3.us-west-1.amazonaws.com https://s3.us-west-2.amazonaws.com https://s3.af-south-1.amazonaws.com https://s3.ap-east-1.amazonaws.com https://s3.ap-south-1.amazonaws.com https://s3.ap-south-2.amazonaws.com https://s3.ap-southeast-1.amazonaws.com https://s3.ap-southeast-2.amazonaws.com https://s3.ap-southeast-3.amazonaws.com https://s3.ap-southeast-4.amazonaws.com https://s3.ap-northeast-1.amazonaws.com https://s3.ap-northeast-2.amazonaws.com https://s3.ap-northeast-3.amazonaws.com https://s3.ca-central-1.amazonaws.com https://s3.eu-central-1.amazonaws.com https://s3.eu-central-2.amazonaws.com https://s3.eu-west-1.amazonaws.com https://s3.eu-west-2.amazonaws.com https://s3.eu-west-3.amazonaws.com https://s3.eu-south-1.amazonaws.com https://s3.eu-south-2.amazonaws.com https://s3.eu-north-1.amazonaws.com https://s3.me-south-1.amazonaws.com https://s3.me-central-1.amazonaws.com https://s3.sa-east-1.amazonaws.com https://s3.us-gov-east-1.amazonaws.com https://s3.us-gov-west-1.amazonaws.com https://*.s3-fips.us-east-1.amazonaws.com https://s3-fips.us-east-1.amazonaws.com https://*.s3-fips.us-east-2.amazonaws.com https://s3-fips.us-east-2.amazonaws.com https://*.s3-fips.us-west-1.amazonaws.com https://s3-fips.us-west-1.amazonaws.com https://*.s3-fips.us-west-2.amazonaws.com https://s3-fips.us-west-2.amazonaws.com https://*.s3-fips.ca-central-1.amazonaws.com https://s3-fips.ca-central-1.amazonaws.com https://*.s3-fips.us-gov-east-1.amazonaws.com https://s3-fips.us-gov-east-1.amazonaws.com https://*.s3-fips.us-gov-west-1.amazonaws.com https://s3-fips.us-gov-west-1.amazonaws.com;
+ connect-src 'self' blob: wss://nexus-websocket-a.intercom.io https://api-iam.intercom.io https://api.heroku.com/ https://id.heroku.com/oauth/authorize https://id.heroku.com/oauth/token https://checkout.stripe.com https://app.posthog.com https://*.posthog.com https://api.stripe.com https://api.pwnedpasswords.com http://127.0.0.1:* https://hcaptcha.com https://*.hcaptcha.com https://www.googletagmanager.com https://www.google-analytics.com https://region1.google-analytics.com https://analytics.google.com https://stats.g.doubleclick.net https://googleads.g.doubleclick.net https://forms.hscollectedforms.net https://forms.hubspot.com https://api.hubapi.com https://*.ads.linkedin.com https://tags.srv.stackadapt.com https://api.unifyintent.com https://pixel-config.reddit.com https://static.ads-twitter.com https://analytics.twitter.com https://cdn.jsdelivr.net/npm/@lottiefiles/[email protected]/dist/dotlottie-player.wasm https://*.s3.amazonaws.com https://*.s3.us-east-1.amazonaws.com https://*.s3.us-east-2.amazonaws.com https://*.s3.us-west-1.amazonaws.com https://*.s3.us-west-2.amazonaws.com https://*.s3.af-south-1.amazonaws.com https://*.s3.ap-east-1.amazonaws.com https://*.s3.ap-south-1.amazonaws.com https://*.s3.ap-south-2.amazonaws.com https://*.s3.ap-southeast-1.amazonaws.com https://*.s3.ap-southeast-2.amazonaws.com https://*.s3.ap-southeast-3.amazonaws.com https://*.s3.ap-southeast-4.amazonaws.com https://*.s3.ap-northeast-1.amazonaws.com https://*.s3.ap-northeast-2.amazonaws.com https://*.s3.ap-northeast-3.amazonaws.com https://*.s3.ca-central-1.amazonaws.com https://*.s3.eu-central-1.amazonaws.com https://*.s3.eu-central-2.amazonaws.com https://*.s3.eu-west-1.amazonaws.com https://*.s3.eu-west-2.amazonaws.com https://*.s3.eu-west-3.amazonaws.com https://*.s3.eu-south-1.amazonaws.com https://*.s3.eu-south-2.amazonaws.com https://*.s3.eu-north-1.amazonaws.com https://*.s3.me-south-1.amazonaws.com https://*.s3.me-central-1.amazonaws.com https://*.s3.sa-east-1.amazonaws.com https://*.s3.us-gov-east-1.amazonaws.com https://*.s3.us-gov-west-1.amazonaws.com https://s3.amazonaws.com https://s3.us-east-1.amazonaws.com https://s3.us-east-2.amazonaws.com https://s3.us-west-1.amazonaws.com https://s3.us-west-2.amazonaws.com https://s3.af-south-1.amazonaws.com https://s3.ap-east-1.amazonaws.com https://s3.ap-south-1.amazonaws.com https://s3.ap-south-2.amazonaws.com https://s3.ap-southeast-1.amazonaws.com https://s3.ap-southeast-2.amazonaws.com https://s3.ap-southeast-3.amazonaws.com https://s3.ap-southeast-4.amazonaws.com https://s3.ap-northeast-1.amazonaws.com https://s3.ap-northeast-2.amazonaws.com https://s3.ap-northeast-3.amazonaws.com https://s3.ca-central-1.amazonaws.com https://s3.eu-central-1.amazonaws.com https://s3.eu-central-2.amazonaws.com https://s3.eu-west-1.amazonaws.com https://s3.eu-west-2.amazonaws.com https://s3.eu-west-3.amazonaws.com https://s3.eu-south-1.amazonaws.com https://s3.eu-south-2.amazonaws.com https://s3.eu-north-1.amazonaws.com https://s3.me-south-1.amazonaws.com https://s3.me-central-1.amazonaws.com https://s3.sa-east-1.amazonaws.com https://s3.us-gov-east-1.amazonaws.com https://s3.us-gov-west-1.amazonaws.com https://*.s3-fips.us-east-1.amazonaws.com https://s3-fips.us-east-1.amazonaws.com https://*.s3-fips.us-east-2.amazonaws.com https://s3-fips.us-east-2.amazonaws.com https://*.s3-fips.us-west-1.amazonaws.com https://s3-fips.us-west-1.amazonaws.com https://*.s3-fips.us-west-2.amazonaws.com https://s3-fips.us-west-2.amazonaws.com https://*.s3-fips.ca-central-1.amazonaws.com https://s3-fips.ca-central-1.amazonaws.com https://*.s3-fips.us-gov-east-1.amazonaws.com https://s3-fips.us-gov-east-1.amazonaws.com https://*.s3-fips.us-gov-west-1.amazonaws.com https://s3-fips.us-gov-west-1.amazonaws.com https://*.r2.cloudflarestorage.com https://storage.googleapis.com https://*.oraclecloud.com https://*.oci.customer-oci.com;
img-src 'self' https://static.intercomassets.com https://js.intercomcdn.com https://downloads.intercomcdn.com https://*.stripe.com https://i.ytimg.com/ data: https://images.ctfassets.net https://www.googletagmanager.com https://www.google-analytics.com https://www.google.com https://googleads.g.doubleclick.net https://www.googleadservices.com https://track.hubspot.com https://forms.hubspot.com https://forms.hsforms.com https://alb.reddit.com https://*.ads.linkedin.com https://analytics.twitter.com;
media-src 'self' https://js.intercomcdn.com;
font-src 'self' data: https://fonts.intercomcdn.com/ https://fonts.gstatic.com;
diff --git a/frontend/public/images/integrations/S3 Compatible.svg b/frontend/public/images/integrations/S3 Compatible.svg
new file mode 100644
index 0000000000..c75b3d653b
--- /dev/null
+++ b/frontend/public/images/integrations/S3 Compatible.svg
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#9AA3B2" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
+ <ellipse cx="12" cy="5.5" rx="8" ry="2.5"/>
+ <path d="M4 5.5 6 19.5c.2 1.2 2.9 2 6 2s5.8-.8 6-2l2-14"/>
+ <path d="M5.1 13c1.3.9 3.9 1.5 6.9 1.5s5.6-.6 6.9-1.5"/>
+</svg>
diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts
index b1c8c3f1af..1f36bc3b27 100644
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@ -90,6 +90,7 @@ import { PowerDnsConnectionMethod } from "@app/hooks/api/appConnections/types/po
import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/railway-connection";
import { RenderConnectionMethod } from "@app/hooks/api/appConnections/types/render-connection";
import { RundeckConnectionMethod } from "@app/hooks/api/appConnections/types/rundeck-connection";
+import { S3CompatibleConnectionMethod } from "@app/hooks/api/appConnections/types/s3-compatible-connection";
import { SalesforceConnectionMethod } from "@app/hooks/api/appConnections/types/salesforce-connection";
import { SmbConnectionMethod } from "@app/hooks/api/appConnections/types/smb-connection";
import { SnowflakeConnectionMethod } from "@app/hooks/api/appConnections/types/snowflake-connection";
@@ -645,6 +646,13 @@ export const APP_CONNECTION_MAP: Record<
image: "Daytona.png",
category: "PLATFORM",
description: "Organization secret access for Daytona sandboxes."
+ },
+ [AppConnection.S3Compatible]: {
+ name: "S3-Compatible Storage",
+ image: "S3 Compatible.svg",
+ aliases: ["aws s3", "cloudflare r2", "google cloud storage", "gcs", "oracle", "oci"],
+ category: "STORAGE",
+ description: "Connect to AWS S3, Cloudflare R2, Google Cloud Storage or OCI Object Storage."
}
};
@@ -677,6 +685,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
return { name: "OAuth", icon: IdCardIcon };
case AwsConnectionMethod.AccessKey:
case OCIConnectionMethod.AccessKey:
+ case S3CompatibleConnectionMethod.AccessKey:
return { name: "Access Key", icon: KeyRoundIcon };
case AwsConnectionMethod.AssumeRole:
return { name: "Assume Role", icon: UserIcon };
diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.ts
index 669e07c66d..89d34530a9 100644
--- a/frontend/src/hooks/api/appConnections/enums.ts
+++ b/frontend/src/hooks/api/appConnections/enums.ts
@@ -84,5 +84,6 @@ export enum AppConnection {
NutanixPrismCentral = "nutanix-prism-central",
Spacelift = "spacelift",
Daytona = "daytona",
- Stripe = "stripe"
+ Stripe = "stripe",
+ S3Compatible = "s3-compatible"
}
diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.ts
index 0d621e3a59..6571dafa94 100644
--- a/frontend/src/hooks/api/appConnections/types/app-options.ts
+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts
@@ -359,6 +359,10 @@ export type TDaytonaConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.Daytona;
};
+export type TS3CompatibleConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.S3Compatible;
+};
+
export type TAppConnectionOption =
| TAwsConnectionOption
| TGitHubConnectionOption
@@ -445,7 +449,8 @@ export type TAppConnectionOption =
| TFireworksConnectionOption
| TNutanixPrismCentralConnectionOption
| TSpaceliftConnectionOption
- | TDaytonaConnectionOption;
+ | TDaytonaConnectionOption
+ | TS3CompatibleConnectionOption;
export type TAppConnectionOptionMap = {
[AppConnection.AWS]: TAwsConnectionOption;
@@ -534,4 +539,5 @@ export type TAppConnectionOptionMap = {
[AppConnection.NutanixPrismCentral]: TNutanixPrismCentralConnectionOption;
[AppConnection.Spacelift]: TSpaceliftConnectionOption;
[AppConnection.Daytona]: TDaytonaConnectionOption;
+ [AppConnection.S3Compatible]: TS3CompatibleConnectionOption;
};
diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.ts
index 9df88a0039..0962f80e05 100644
--- a/frontend/src/hooks/api/appConnections/types/index.ts
+++ b/frontend/src/hooks/api/appConnections/types/index.ts
@@ -69,6 +69,7 @@ import { TRailwayConnection } from "./railway-connection";
import { TRedisConnection } from "./redis-connection";
import { TRenderConnection } from "./render-connection";
import { TRundeckConnection } from "./rundeck-connection";
+import { TS3CompatibleConnection } from "./s3-compatible-connection";
import { TSalesforceConnection } from "./salesforce-connection";
import { TSmbConnection } from "./smb-connection";
import { TSnowflakeConnection } from "./snowflake-connection";
@@ -153,6 +154,7 @@ export * from "./railway-connection";
export * from "./redis-connection";
export * from "./render-connection";
export * from "./rundeck-connection";
+export * from "./s3-compatible-connection";
export * from "./salesforce-connection";
export * from "./smb-connection";
export * from "./snowflake-connection";
@@ -257,7 +259,8 @@ export type TAppConnection =
| TPowerDnsConnection
| TSpaceliftConnection
| TDaytonaConnection
- | TStripeConnection;
+ | TStripeConnection
+ | TS3CompatibleConnection;
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id" | "projectId">;
diff --git a/frontend/src/hooks/api/appConnections/types/s3-compatible-connection.ts b/frontend/src/hooks/api/appConnections/types/s3-compatible-connection.ts
new file mode 100644
index 0000000000..adb6c9c482
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/types/s3-compatible-connection.ts
@@ -0,0 +1,15 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
+
+export enum S3CompatibleConnectionMethod {
+ AccessKey = "access-key"
+}
+
+export type TS3CompatibleConnection = TRootAppConnection & { app: AppConnection.S3Compatible } & {
+ method: S3CompatibleConnectionMethod.AccessKey;
+ credentials: {
+ endpoint: string;
+ accessKeyId: string;
+ secretAccessKey: string;
+ };
+};
diff --git a/frontend/src/hooks/api/pam/constants.ts b/frontend/src/hooks/api/pam/constants.ts
index 8cdbd3324b..be50ed8148 100644
--- a/frontend/src/hooks/api/pam/constants.ts
+++ b/frontend/src/hooks/api/pam/constants.ts
@@ -1 +1,5 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+
export const UNCHANGED_PASSWORD_SENTINEL = "__INFISICAL_UNCHANGED__";
+
+export const PAM_RECORDING_CONNECTION_APPS = [AppConnection.AWS, AppConnection.S3Compatible];
diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.ts
index 130134cadd..99fa567185 100644
--- a/frontend/src/hooks/api/pam/types/index.ts
+++ b/frontend/src/hooks/api/pam/types/index.ts
@@ -199,7 +199,7 @@ export const accountTypeRequiresRecording = (type: PamAccountType): boolean =>
type === PamAccountType.Windows || type === PamAccountType.WindowsAd;
export type TPamAccountSettingsOverrides = {
- recordingS3Config?: { bucket: string; region: string; keyPrefix?: string };
+ recordingS3Config?: { bucket: string; region?: string; keyPrefix?: string };
};
export type TPamAccount = {
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
index fc22a2b9fd..b6e9f26b1f 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@ -83,6 +83,7 @@ import { RailwayConnectionForm } from "./RailwayConnectionForm";
import { RedisConnectionForm } from "./RedisConnectionForm";
import { RenderConnectionForm } from "./RenderConnectionForm";
import { RundeckConnectionForm } from "./RundeckConnectionForm";
+import { S3CompatibleConnectionForm } from "./S3CompatibleConnectionForm";
import { SalesforceConnectionForm } from "./SalesforceConnectionForm";
import { SmbConnectionForm } from "./SmbConnectionForm";
import { SnowflakeConnectionForm } from "./SnowflakeConnectionForm";
@@ -275,6 +276,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {
return <DNSMadeEasyConnectionForm onSubmit={onSubmit} />;
case AppConnection.Spacelift:
return <SpaceliftConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.S3Compatible:
+ return <S3CompatibleConnectionForm onSubmit={onSubmit} />;
case AppConnection.AzureDNS:
return <AzureDNSConnectionForm onSubmit={onSubmit} />;
case AppConnection.Bitbucket:
@@ -564,6 +567,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
return <DNSMadeEasyConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Spacelift:
return <SpaceliftConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.S3Compatible:
+ return <S3CompatibleConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.AzureDNS:
return <AzureDNSConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Bitbucket:
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/S3CompatibleConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/S3CompatibleConnectionForm.tsx
new file mode 100644
index 0000000000..928a6a69d8
--- /dev/null
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/S3CompatibleConnectionForm.tsx
@@ -0,0 +1,202 @@
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { Info } from "lucide-react";
+import { z } from "zod";
+
+import {
+ Field,
+ FieldError,
+ FieldLabel,
+ Input,
+ SecretInput,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";
+import { TS3CompatibleConnection } from "@app/hooks/api/appConnections";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { S3CompatibleConnectionMethod } from "@app/hooks/api/appConnections/types/s3-compatible-connection";
+
+import { AppConnectionFormFooter } from "./AppConnectionFormFooter";
+import {
+ genericAppConnectionFieldsSchema,
+ GenericAppConnectionsFields
+} from "./GenericAppConnectionFields";
+
+const S3_COMPATIBLE_ENDPOINT_EXAMPLES = [
+ "https://s3.<region>.amazonaws.com",
+ "https://<account-id>.r2.cloudflarestorage.com",
+ "https://storage.googleapis.com",
+ "https://<namespace>.compat.objectstorage.<region>.oraclecloud.com"
+];
+
+type Props = {
+ appConnection?: TS3CompatibleConnection;
+ onSubmit: (formData: FormData) => Promise<void>;
+};
+
+const rootSchema = genericAppConnectionFieldsSchema.extend({
+ app: z.literal(AppConnection.S3Compatible)
+});
+
+const formSchema = z.discriminatedUnion("method", [
+ rootSchema.extend({
+ method: z.literal(S3CompatibleConnectionMethod.AccessKey),
+ credentials: z.object({
+ endpoint: z
+ .string()
+ .trim()
+ .min(1, "Endpoint required")
+ .url("Must be a valid URL")
+ .startsWith("https://", "Endpoint must use HTTPS"),
+ accessKeyId: z.string().trim().min(1, "Access Key ID required"),
+ secretAccessKey: z.string().trim().min(1, "Secret Access Key required")
+ })
+ })
+]);
+
+type FormData = z.infer<typeof formSchema>;
+
+export const S3CompatibleConnectionForm = ({ appConnection, onSubmit }: Props) => {
+ const isUpdate = Boolean(appConnection);
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: appConnection ?? {
+ app: AppConnection.S3Compatible,
+ method: S3CompatibleConnectionMethod.AccessKey,
+ credentials: {
+ endpoint: "",
+ accessKeyId: "",
+ secretAccessKey: ""
+ }
+ }
+ });
+
+ const { handleSubmit, control } = form;
+
+ return (
+ <FormProvider {...form}>
+ <form onSubmit={handleSubmit(onSubmit)}>
+ {!isUpdate && <GenericAppConnectionsFields />}
+ <Controller
+ name="method"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="method">
+ Method
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-sm">
+ The method you would like to use to connect with{" "}
+ {APP_CONNECTION_MAP[AppConnection.S3Compatible].name}. This field cannot be
+ changed after creation.
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <Select disabled={isUpdate} value={value} onValueChange={(val) => onChange(val)}>
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ <SelectValue placeholder="Select a method..." />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {Object.values(S3CompatibleConnectionMethod).map((method) => {
+ return (
+ <SelectItem value={method} key={method}>
+ {getAppConnectionMethodDetails(method).name}{" "}
+ </SelectItem>
+ );
+ })}
+ </SelectContent>
+ </Select>
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ <Controller
+ name="credentials.endpoint"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="endpoint">
+ Endpoint
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-sm">
+ <p>The S3 API endpoint of your provider, without the bucket name:</p>
+ <ul className="mt-1 list-disc pl-4 font-mono text-xs">
+ {S3_COMPATIBLE_ENDPOINT_EXAMPLES.map((example) => (
+ <li key={example}>{example}</li>
+ ))}
+ </ul>
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <Input
+ id="endpoint"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder="https://s3.us-east-1.amazonaws.com"
+ isError={Boolean(error?.message)}
+ />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ <Controller
+ name="credentials.accessKeyId"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="access-key-id">Access Key ID</FieldLabel>
+ <Input
+ id="access-key-id"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ isError={Boolean(error?.message)}
+ />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ <Controller
+ name="credentials.secretAccessKey"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="secret-access-key">Secret Access Key</FieldLabel>
+ <SecretInput
+ aria-describedby={error ? "secret-access-key-error" : undefined}
+ id="secret-access-key"
+ isError={Boolean(error)}
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ <FieldError id="secret-access-key-error" errors={[error]} />
+ </Field>
+ )}
+ />
+ <AppConnectionFormFooter
+ submitLabel={
+ isUpdate
+ ? "Update Credentials"
+ : `Connect to ${APP_CONNECTION_MAP[AppConnection.S3Compatible].name}`
+ }
+ />
+ </form>
+ </FormProvider>
+ );
+};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx
index ee01ac2354..005991411c 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx
@@ -47,7 +47,7 @@ import {
} from "@app/components/v3";
import { Skeleton } from "@app/components/v3/generic/Skeleton";
import { useOrganization, useUser } from "@app/context";
-import { useListAppConnections } from "@app/hooks/api/appConnections";
+import { AppConnection, useListAppConnections } from "@app/hooks/api/appConnections";
import { gatewayPoolsQueryKeys } from "@app/hooks/api/gateway-pools/queries";
import { gatewaysQueryKeys } from "@app/hooks/api/gateways/queries";
import { useGetOrganizationGroups } from "@app/hooks/api/organization/queries";
@@ -585,6 +585,9 @@ const SettingsTab = ({
const hasRecordingOverride =
Boolean(recordingConnId) || Boolean(recordingBucket) || Boolean(recordingRegion);
const isRecordingOverriding = hasRecordingOverride || showRecordingPicker;
+ const isS3CompatibleRecording =
+ appConnections.find((c) => c.id === (recordingConnId ?? template?.recordingConnectionId))
+ ?.app === AppConnection.S3Compatible;
const resolveGatewayLabel = (gwId?: string | null, poolId?: string | null) => {
if (poolId) return gatewayPools?.find((p) => p.id === poolId)?.name ?? "Gateway pool";
@@ -595,7 +598,7 @@ const SettingsTab = ({
const resolveConnectionName = (connId?: string | null) => {
if (!connId) return "None";
- return appConnections.find((c) => c.id === connId)?.name ?? "AWS connection";
+ return appConnections.find((c) => c.id === connId)?.name ?? "Connection";
};
const inheritedRecordingLabel = resolveConnectionName(template?.recordingConnectionId);
@@ -632,7 +635,7 @@ const SettingsTab = ({
? {
recordingS3Config: {
bucket,
- region,
+ ...(region && !isS3CompatibleRecording ? { region } : {}),
...(keyPrefix ? { keyPrefix } : {})
}
}
@@ -799,7 +802,7 @@ const SettingsTab = ({
</AlertDescription>
</Alert>
<div>
- <p className="mb-1 text-sm text-muted">AWS Connection</p>
+ <p className="mb-1 text-sm text-muted">Connection</p>
<RecordingConnectionPicker
value={recordingConnId}
onChange={(v) => setValue("recordingConnectionId", v, { shouldDirty: true })}
@@ -807,14 +810,16 @@ const SettingsTab = ({
/>
</div>
<div className="grid grid-cols-2 gap-3">
- <div>
+ <div className={isS3CompatibleRecording ? "col-span-2" : undefined}>
<p className="mb-1 text-sm text-muted">S3 Bucket</p>
<Input placeholder="my-recordings-bucket" {...register("recordingBucket")} />
</div>
- <div>
- <p className="mb-1 text-sm text-muted">Region</p>
- <Input placeholder="us-east-1" {...register("recordingRegion")} />
- </div>
+ {!isS3CompatibleRecording && (
+ <div>
+ <p className="mb-1 text-sm text-muted">Region</p>
+ <Input placeholder="us-east-1" {...register("recordingRegion")} />
+ </div>
+ )}
</div>
<div>
<p className="mb-1 text-sm text-muted">
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/RecordingConnectionPicker.tsx b/frontend/src/pages/pam/PamAccountsPage/components/RecordingConnectionPicker.tsx
index 75a3364ac4..c32c7beb51 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/RecordingConnectionPicker.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/RecordingConnectionPicker.tsx
@@ -1,6 +1,6 @@
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@app/components/v3";
-import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { useListAppConnections } from "@app/hooks/api/appConnections/queries";
+import { PAM_RECORDING_CONNECTION_APPS } from "@app/hooks/api/pam/constants";
const NONE_VALUE = "__none__";
@@ -13,8 +13,8 @@ type Props = {
export const RecordingConnectionPicker = ({ value, onChange, isError, includeNone }: Props) => {
const { data: connections = [], isPending } = useListAppConnections();
- const awsConnections = connections.filter(
- (connection) => connection.app === AppConnection.AWS && !connection.projectId
+ const recordingConnections = connections.filter(
+ (connection) => PAM_RECORDING_CONNECTION_APPS.includes(connection.app) && !connection.projectId
);
return (
@@ -28,12 +28,13 @@ export const RecordingConnectionPicker = ({ value, onChange, isError, includeNon
</SelectTrigger>
<SelectContent position="popper" className="z-[70]">
{includeNone && <SelectItem value={NONE_VALUE}>None</SelectItem>}
- {awsConnections.length === 0 && (
+ {recordingConnections.length === 0 && (
<div className="px-2 py-3 text-center text-xs text-muted">
- No AWS connections found. Create one from the App Connections page.
+ No AWS or S3-Compatible Storage connections found. Create one from the App Connections
+ page.
</div>
)}
- {awsConnections.map((connection) => (
+ {recordingConnections.map((connection) => (
<SelectItem key={connection.id} value={connection.id}>
{connection.name}
</SelectItem>
diff --git a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx
index 451245eb89..b70e578a13 100644
--- a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx
+++ b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx
@@ -34,7 +34,10 @@ import {
} from "@app/components/v3";
import { Skeleton } from "@app/components/v3/generic/Skeleton";
import { useProject } from "@app/context";
-import { AppConnection, useListAvailableAppConnections } from "@app/hooks/api/appConnections";
+import {
+ AppConnection,
+ useListAvailableAppConnectionsForApps
+} from "@app/hooks/api/appConnections";
import {
accountTypeRequiresRecording,
isRotatablePamAccountType,
@@ -47,6 +50,7 @@ import {
usePamAccountTypeMap,
useUpdatePamAccountTemplate
} from "@app/hooks/api/pam";
+import { PAM_RECORDING_CONNECTION_APPS } from "@app/hooks/api/pam/constants";
import { ApiErrorTypes, TApiErrors } from "@app/hooks/api/types";
import { PamSheetTab, usePamSheetState } from "@app/hooks/usePamSheetState";
@@ -95,7 +99,7 @@ const buildSettingsSchema = (maxPwLength: number) =>
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["recordingConnectionId"],
- message: "Select an AWS connection"
+ message: "Select a connection"
});
}
if (!data.s3Bucket?.trim()) {
@@ -275,8 +279,8 @@ const SettingsTab = ({
const { data: template, isLoading } = useGetPamAccountTemplate(templateId);
const updateTemplate = useUpdatePamAccountTemplate({ skipValidationToast: true });
const { currentProject } = useProject();
- const { data: awsConnections = [] } = useListAvailableAppConnections(
- AppConnection.AWS,
+ const { connections: recordingConnections } = useListAvailableAppConnectionsForApps(
+ PAM_RECORDING_CONNECTION_APPS,
currentProject.id
);
const { map: accountTypeMap } = usePamAccountTypeMap();
@@ -398,6 +402,9 @@ const SettingsTab = ({
const gatewayPoolId = watch("gatewayPoolId");
const policies = watch("policies");
const storageBackend = watch("recordingStorageBackend");
+ const recordingConnectionApp = recordingConnections.find(
+ (conn) => conn.id === watch("recordingConnectionId")
+ )?.app;
const rotationEnabled = watch("settings.rotationEnabled");
const heartbeatEnabled = watch("settings.heartbeatEnabled");
const requiresRecording = accountTypeRequiresRecording(template.type);
@@ -420,7 +427,9 @@ const SettingsTab = ({
if (data.recordingStorageBackend === "aws-s3" && data.s3Bucket) {
settings.recordingS3Config = {
bucket: data.s3Bucket,
- region: data.s3Region || "us-east-1",
+ ...(recordingConnectionApp === AppConnection.S3Compatible
+ ? {}
+ : { region: data.s3Region || "us-east-1" }),
...(data.s3KeyPrefix ? { keyPrefix: data.s3KeyPrefix } : {})
};
} else {
@@ -848,7 +857,7 @@ const SettingsTab = ({
</SelectTrigger>
<SelectContent position="popper">
<SelectItem value="postgres">Internal Database</SelectItem>
- <SelectItem value="aws-s3">AWS S3</SelectItem>
+ <SelectItem value="aws-s3">S3 Bucket</SelectItem>
</SelectContent>
</Select>
</FieldContent>
@@ -885,17 +894,17 @@ const SettingsTab = ({
control={control}
render={({ field, fieldState }) => (
<Field>
- <FieldLabel>AWS Connection</FieldLabel>
+ <FieldLabel>Connection</FieldLabel>
<FieldContent>
<Select
value={field.value ?? ""}
onValueChange={(v) => field.onChange(v || null)}
>
<SelectTrigger className="w-full" isError={!!fieldState.error}>
- <SelectValue placeholder="Select an AWS connection" />
+ <SelectValue placeholder="Select a connection" />
</SelectTrigger>
<SelectContent position="popper">
- {awsConnections.map((conn) => (
+ {recordingConnections.map((conn) => (
<SelectItem key={conn.id} value={conn.id}>
{conn.name}
</SelectItem>
@@ -906,7 +915,7 @@ const SettingsTab = ({
<FieldError>{fieldState.error.message}</FieldError>
) : (
<FieldDescription>
- The AWS connection used to authenticate with S3.
+ The AWS or S3-Compatible Storage connection used to access the bucket.
</FieldDescription>
)}
</FieldContent>
@@ -932,18 +941,20 @@ const SettingsTab = ({
)}
/>
- <Controller
- name="s3Region"
- control={control}
- render={({ field }) => (
- <Field>
- <FieldLabel>Region</FieldLabel>
- <FieldContent>
- <Input {...field} placeholder="us-east-1" />
- </FieldContent>
- </Field>
- )}
- />
+ {recordingConnectionApp !== AppConnection.S3Compatible && (
+ <Controller
+ name="s3Region"
+ control={control}
+ render={({ field }) => (
+ <Field>
+ <FieldLabel>Region</FieldLabel>
+ <FieldContent>
+ <Input {...field} placeholder="us-east-1" />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ )}
<Controller
name="s3KeyPrefix"