mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-11 15:29:46 +00:00
feat: added same for secret rotation
This commit is contained in:
+2
-21
@@ -8,10 +8,9 @@ import axios from "axios";
|
|||||||
import jmespath from "jmespath";
|
import jmespath from "jmespath";
|
||||||
import knex from "knex";
|
import knex from "knex";
|
||||||
|
|
||||||
import { getConfig } from "@app/lib/config/env";
|
|
||||||
import { getDbConnectionHost } from "@app/lib/knex";
|
|
||||||
import { alphaNumericNanoId } from "@app/lib/nanoid";
|
import { alphaNumericNanoId } from "@app/lib/nanoid";
|
||||||
|
|
||||||
|
import { verifyHostInputValidity } from "../../dynamic-secret/dynamic-secret-fns";
|
||||||
import { TAssignOp, TDbProviderClients, TDirectAssignOp, THttpProviderFunction } from "../templates/types";
|
import { TAssignOp, TDbProviderClients, TDirectAssignOp, THttpProviderFunction } from "../templates/types";
|
||||||
import { TSecretRotationData, TSecretRotationDbFn } from "./secret-rotation-queue-types";
|
import { TSecretRotationData, TSecretRotationDbFn } from "./secret-rotation-queue-types";
|
||||||
|
|
||||||
@@ -88,26 +87,8 @@ export const secretRotationDbFn = async ({
|
|||||||
variables,
|
variables,
|
||||||
options
|
options
|
||||||
}: TSecretRotationDbFn) => {
|
}: TSecretRotationDbFn) => {
|
||||||
const appCfg = getConfig();
|
|
||||||
|
|
||||||
const ssl = ca ? { rejectUnauthorized: false, ca } : undefined;
|
const ssl = ca ? { rejectUnauthorized: false, ca } : undefined;
|
||||||
const isCloud = Boolean(appCfg.LICENSE_SERVER_KEY); // quick and dirty way to check if its cloud or not
|
await verifyHostInputValidity(host);
|
||||||
const dbHost = appCfg.DB_HOST || getDbConnectionHost(appCfg.DB_CONNECTION_URI);
|
|
||||||
|
|
||||||
if (
|
|
||||||
isCloud &&
|
|
||||||
// internal ips
|
|
||||||
(host === "host.docker.internal" || host.match(/^10\.\d+\.\d+\.\d+/) || host.match(/^192\.168\.\d+\.\d+/))
|
|
||||||
)
|
|
||||||
throw new Error("Invalid db host");
|
|
||||||
if (
|
|
||||||
host === "localhost" ||
|
|
||||||
host === "127.0.0.1" ||
|
|
||||||
// database infisical uses
|
|
||||||
dbHost === host
|
|
||||||
)
|
|
||||||
throw new Error("Invalid db host");
|
|
||||||
|
|
||||||
const db = knex({
|
const db = knex({
|
||||||
client,
|
client,
|
||||||
connection: {
|
connection: {
|
||||||
|
|||||||
Reference in New Issue
Block a user