mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-19 21:21:29 +00:00
Merge branch 'main' into feature/slack-secret-sync-error-notification
This commit is contained in:
@@ -2348,6 +2348,9 @@ export const AppConnections = {
|
||||
RAILWAY: {
|
||||
apiToken: "The API token used to authenticate with Railway."
|
||||
},
|
||||
NORTHFLANK: {
|
||||
apiToken: "The API token used to authenticate with Northflank."
|
||||
},
|
||||
CHECKLY: {
|
||||
apiKey: "The API key used to authenticate with Checkly."
|
||||
},
|
||||
@@ -2376,6 +2379,12 @@ export const AppConnections = {
|
||||
},
|
||||
LARAVEL_FORGE: {
|
||||
apiToken: "The API token used to authenticate with Laravel Forge."
|
||||
},
|
||||
CHEF: {
|
||||
serverUrl: "The URL of the Chef server to connect to.",
|
||||
orgName: "The short name of the Chef organization to connect to.",
|
||||
userName: "The username used to access Chef.",
|
||||
privateKey: "The private key used to access Chef."
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2620,6 +2629,16 @@ export const SecretSyncs = {
|
||||
siteName: "The name of the Netlify site to sync secrets to.",
|
||||
siteId: "The ID of the Netlify site to sync secrets to.",
|
||||
context: "The Netlify context to sync secrets to."
|
||||
},
|
||||
CHEF: {
|
||||
dataBagName: "The name of the Chef data bag to sync secrets to.",
|
||||
dataBagItemName: "The name of the Chef data bag item to sync secrets to."
|
||||
},
|
||||
NORTHFLANK: {
|
||||
projectId: "The ID of the Northflank project to sync secrets to.",
|
||||
projectName: "The name of the Northflank project to sync secrets to.",
|
||||
secretGroupId: "The ID of the Northflank secret group to sync secrets to.",
|
||||
secretGroupName: "The name of the Northflank secret group to sync secrets to."
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ import https from "https";
|
||||
import { verifyHostInputValidity } from "@app/ee/services/dynamic-secret/dynamic-secret-fns";
|
||||
import { splitPemChain } from "@app/services/certificate/certificate-fns";
|
||||
|
||||
import { getConfig } from "../config/env";
|
||||
import { BadRequestError } from "../errors";
|
||||
import { GatewayProxyProtocol } from "../gateway/types";
|
||||
import { logger } from "../logger";
|
||||
@@ -80,6 +81,8 @@ const createGatewayConnection = async (
|
||||
gateway: { clientCertificate: string; clientPrivateKey: string; serverCertificateChain: string },
|
||||
protocol: GatewayProxyProtocol
|
||||
): Promise<net.Socket> => {
|
||||
const appCfg = getConfig();
|
||||
|
||||
const protocolToAlpn = {
|
||||
[GatewayProxyProtocol.Http]: "infisical-http-proxy",
|
||||
[GatewayProxyProtocol.Tcp]: "infisical-tcp-proxy",
|
||||
@@ -94,7 +97,8 @@ const createGatewayConnection = async (
|
||||
minVersion: "TLSv1.2",
|
||||
maxVersion: "TLSv1.3",
|
||||
rejectUnauthorized: true,
|
||||
ALPNProtocols: [protocolToAlpn[protocol]]
|
||||
ALPNProtocols: [protocolToAlpn[protocol]],
|
||||
checkServerIdentity: appCfg.isDevelopmentMode ? () => undefined : tls.checkServerIdentity
|
||||
};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
import { requestContext } from "@fastify/request-context";
|
||||
import opentelemetry from "@opentelemetry/api";
|
||||
|
||||
import { getConfig } from "../config/env";
|
||||
|
||||
const infisicalMeter = opentelemetry.metrics.getMeter("Infisical");
|
||||
|
||||
export enum AuthAttemptAuthMethod {
|
||||
EMAIL = "email",
|
||||
SAML = "saml",
|
||||
OIDC = "oidc",
|
||||
GOOGLE = "google",
|
||||
GITHUB = "github",
|
||||
GITLAB = "gitlab",
|
||||
TOKEN_AUTH = "token-auth",
|
||||
UNIVERSAL_AUTH = "universal-auth",
|
||||
KUBERNETES_AUTH = "kubernetes-auth",
|
||||
GCP_AUTH = "gcp-auth",
|
||||
ALICLOUD_AUTH = "alicloud-auth",
|
||||
AWS_AUTH = "aws-auth",
|
||||
AZURE_AUTH = "azure-auth",
|
||||
TLS_CERT_AUTH = "tls-cert-auth",
|
||||
OCI_AUTH = "oci-auth",
|
||||
OIDC_AUTH = "oidc-auth",
|
||||
JWT_AUTH = "jwt-auth",
|
||||
LDAP_AUTH = "ldap-auth"
|
||||
}
|
||||
|
||||
export enum AuthAttemptAuthResult {
|
||||
SUCCESS = "success",
|
||||
FAILURE = "failure"
|
||||
}
|
||||
|
||||
export const authAttemptCounter = infisicalMeter.createCounter("infisical.auth.attempt.count", {
|
||||
description: "Authentication attempts (both successful and failed)",
|
||||
unit: "{attempt}"
|
||||
});
|
||||
|
||||
export const secretReadCounter = infisicalMeter.createCounter("infisical.secret.read.count", {
|
||||
description: "Number of secret read operations",
|
||||
unit: "{operation}"
|
||||
});
|
||||
|
||||
export const recordSecretReadMetric = (params: { environment: string; secretPath: string; name?: string }) => {
|
||||
const appCfg = getConfig();
|
||||
|
||||
if (appCfg.OTEL_TELEMETRY_COLLECTION_ENABLED) {
|
||||
const attributes: Record<string, string> = {
|
||||
"infisical.environment": params.environment,
|
||||
"infisical.secret.path": params.secretPath,
|
||||
...(params.name ? { "infisical.secret.name": params.name } : {})
|
||||
};
|
||||
|
||||
const orgId = requestContext.get("orgId");
|
||||
if (orgId) {
|
||||
attributes["infisical.organization.id"] = orgId;
|
||||
}
|
||||
|
||||
const orgName = requestContext.get("orgName");
|
||||
if (orgName) {
|
||||
attributes["infisical.organization.name"] = orgName;
|
||||
}
|
||||
|
||||
const projectDetails = requestContext.get("projectDetails");
|
||||
if (projectDetails?.id) {
|
||||
attributes["infisical.project.id"] = projectDetails.id;
|
||||
}
|
||||
if (projectDetails?.name) {
|
||||
attributes["infisical.project.name"] = projectDetails.name;
|
||||
}
|
||||
|
||||
const userAuthInfo = requestContext.get("userAuthInfo");
|
||||
if (userAuthInfo?.userId) {
|
||||
attributes["infisical.user.id"] = userAuthInfo.userId;
|
||||
}
|
||||
if (userAuthInfo?.email) {
|
||||
attributes["infisical.user.email"] = userAuthInfo.email;
|
||||
}
|
||||
|
||||
const identityAuthInfo = requestContext.get("identityAuthInfo");
|
||||
if (identityAuthInfo?.identityId) {
|
||||
attributes["infisical.identity.id"] = identityAuthInfo.identityId;
|
||||
}
|
||||
if (identityAuthInfo?.identityName) {
|
||||
attributes["infisical.identity.name"] = identityAuthInfo.identityName;
|
||||
}
|
||||
|
||||
const userAgent = requestContext.get("userAgent");
|
||||
if (userAgent) {
|
||||
attributes["user_agent.original"] = userAgent;
|
||||
}
|
||||
|
||||
const ip = requestContext.get("ip");
|
||||
if (ip) {
|
||||
attributes["client.address"] = ip;
|
||||
}
|
||||
|
||||
secretReadCounter.add(1, attributes);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user