Skip to content

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

add S3_COMPATIBLE_STORAGE_ALLOW_INTERNAL_IP

Andreyb528bf39a320
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts
index 5d0ebd82ee..7276562e1a 100644
--- a/backend/src/lib/config/env.ts
+++ b/backend/src/lib/config/env.ts
@@ -559,6 +559,7 @@ const envSchema = z
DYNAMIC_SECRET_ALLOW_INTERNAL_IP: zodStrBool.default("false"),
AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP: zodStrBool.default("false"),
+ S3_COMPATIBLE_STORAGE_ALLOW_INTERNAL_IP: zodStrBool.default("false"),
DYNAMIC_SECRET_AWS_ACCESS_KEY_ID: zpStr(z.string().optional()).default(
process.env.INF_APP_CONNECTION_AWS_ACCESS_KEY_ID
),
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
index 3a6456c51b..be5f83cfb1 100644
--- 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
@@ -3,6 +3,7 @@ import type { Agent } from "node:https";
import { ListBucketsCommand, S3ServiceException } from "@aws-sdk/client-s3";
import { createS3Client } from "@app/lib/aws/s3";
+import { getConfig } from "@app/lib/config/env";
import { BadRequestError } from "@app/lib/errors";
import { logger } from "@app/lib/logger";
import { buildSsrfSafeAgent } from "@app/lib/validator";
@@ -26,10 +27,12 @@ export const getS3CompatibleConnectionListItem = () => {
};
const buildCustomHostAgent = async (origin: string, host: string) =>
- (await buildSsrfSafeAgent(origin).catch((error: NodeJS.ErrnoException) => {
- if (error.code !== "ENOTFOUND" && error.code !== "EAI_AGAIN") throw error;
- throw new BadRequestError({ message: `Could not resolve ${host}. Verify the hostname and try again.` });
- })) as Agent | undefined;
+ (await buildSsrfSafeAgent(origin, { allowPrivateIps: getConfig().S3_COMPATIBLE_STORAGE_ALLOW_INTERNAL_IP }).catch(
+ (error: NodeJS.ErrnoException) => {
+ if (error.code !== "ENOTFOUND" && error.code !== "EAI_AGAIN") throw error;
+ throw new BadRequestError({ message: `Could not resolve ${host}. Verify the hostname and try again.` });
+ }
+ )) as Agent | undefined;
export const getS3CompatibleConnectionConfig = async ({
credentials
diff --git a/docs/documentation/platform/admin-panel/server-admin.mdx b/docs/documentation/platform/admin-panel/server-admin.mdx
index 994d50d0b3..ba3c887095 100644
--- a/docs/documentation/platform/admin-panel/server-admin.mdx
+++ b/docs/documentation/platform/admin-panel/server-admin.mdx
@@ -65,7 +65,7 @@ Select **Save** to apply either change.
### Allowed storage hostnames
-If you store [PAM session recordings](/documentation/platform/pam/sessions/external-storage) on your own S3-compatible server, such as MinIO, add the server's hostname under **Hostnames** and select **Save**. Include the port if it isn't 443, such as `minio.example.com:9000`, and make sure the server accepts HTTPS connections. If the hostname resolves to a private IP address, also set [`ALLOW_INTERNAL_IP_CONNECTIONS`](/self-hosting/configuration/envars#param-allow-internal-ip-connections) to `true`.
+If you store [PAM session recordings](/documentation/platform/pam/sessions/external-storage) on your own S3-compatible server, such as MinIO, add the server's hostname under **Hostnames** and select **Save**. Include the port if it isn't 443, such as `minio.example.com:9000`, and make sure the server accepts HTTPS connections. If the hostname resolves to a private IP address, also set [`S3_COMPATIBLE_STORAGE_ALLOW_INTERNAL_IP`](/self-hosting/configuration/envars#param-s3-compatible-storage-allow-internal-ip) to `true`.
An S3-Compatible Storage connection can then use the server as its endpoint, and browsers can play back recordings stored there. If the server expects a signing region other than `us-east-1`, as Garage does, enter it under **Region** on the connection.
diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdx
index e4f1153118..c0a93a0777 100644
--- a/docs/self-hosting/configuration/envars.mdx
+++ b/docs/self-hosting/configuration/envars.mdx
@@ -86,8 +86,9 @@ Example values:
For reaching private resources, prefer the [Gateway](/documentation/platform/gateways/overview),
which tunnels traffic through an agent inside your network and doesn't require
opening any internal IP range on the Infisical instance. Use this flag (or the
- more targeted `DYNAMIC_SECRET_ALLOW_INTERNAL_IP` / `AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP`
- flags) only for the features that egress directly, without a Gateway.
+ more targeted `DYNAMIC_SECRET_ALLOW_INTERNAL_IP` / `AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP` /
+ `S3_COMPATIBLE_STORAGE_ALLOW_INTERNAL_IP` flags) only for the features that egress directly,
+ without a Gateway.
<Warning>
Relaxes the SSRF protection. In addition to allowing private IPs, enabling
@@ -376,6 +377,14 @@ ClickHouse can be used as an alternative audit log storage backend for high-volu
</Warning>
</ParamField>
+<ParamField query="S3_COMPATIBLE_STORAGE_ALLOW_INTERNAL_IP" type="bool" default="false" optional>
+ Determines whether S3-Compatible Storage connections can reach an [allowed storage hostname](/documentation/platform/admin-panel/server-admin#allowed-storage-hostnames) that resolves to an internal/private IP address, such as a MinIO server on your network.
+
+ <Warning>
+ Relaxes the SSRF protection for these connections and turns off their DNS-rebinding pin protection. Only enable it if you trust the users who can configure app connections.
+ </Warning>
+</ParamField>
+
### Redis
Redis is used for caching and background tasks. You can use either a standalone Redis instance, Redis Sentinel, or Redis Cluster setup.