Skip to content

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

Do not enable in production

Fang-Pen Lin142316db80ac
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts
index 96107306f7..11de576670 100644
--- a/backend/src/lib/config/env.ts
+++ b/backend/src/lib/config/env.ts
@@ -400,7 +400,7 @@ const envSchema = z
isAcmeDevelopmentMode: data.NODE_ENV === "development" && data.ACME_DEVELOPMENT_MODE,
isProductionMode: data.NODE_ENV === "production" || IS_PACKAGED,
isRedisSentinelMode: Boolean(data.REDIS_SENTINEL_HOSTS),
- isBddNockApiEnabled: data.NODE_ENV === "development" && data.BDD_NOCK_API_ENABLED,
+ isBddNockApiEnabled: data.NODE_ENV !== "production" && data.BDD_NOCK_API_ENABLED,
REDIS_SENTINEL_HOSTS: data.REDIS_SENTINEL_HOSTS?.trim()
?.split(",")
.map((el) => {
diff --git a/backend/src/server/routes/bdd/bdd-nock-router.dev.ts b/backend/src/server/routes/bdd/bdd-nock-router.dev.ts
index ee5617686f..2c119d42b7 100644
--- a/backend/src/server/routes/bdd/bdd-nock-router.dev.ts
+++ b/backend/src/server/routes/bdd/bdd-nock-router.dev.ts
@@ -10,8 +10,8 @@ import { AuthMode } from "@app/services/auth/auth-type";
// When running in production, we don't want to even import nock, because it's not needed and it increases memory usage a lots.
// It once caused an outage in the production environment.
// This is why we would rather to crash the app if it's not in development mode (in that case, Kubernetes should stop it from rolling out).
-if (process.env.NODE_ENV !== "development") {
- throw new Error("BDD Nock API is not enabled");
+if (process.env.NODE_ENV === "production") {
+ throw new Error("BDD Nock API can only be enabled in development or test mode");
}
export const registerBddNockRouter = async (server: FastifyZodProvider) => {
@@ -24,7 +24,7 @@ export const registerBddNockRouter = async (server: FastifyZodProvider) => {
const checkIfBddNockApiEnabled = () => {
// Note: Please note that this API is only available in development mode and only for BDD tests.
// This endpoint should NEVER BE ENABLED IN PRODUCTION!
- if (appCfg.NODE_ENV !== "development" || !appCfg.isBddNockApiEnabled) {
+ if (appCfg.NODE_ENV === "production" || !appCfg.isBddNockApiEnabled) {
throw new ForbiddenRequestError({ message: "BDD Nock API is not enabled" });
}
};