mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 18:26:42 +00:00
Merge branch 'main' of https://github.com/Infisical/infisical into fix/folder-sorting
This commit is contained in:
+5
-6
@@ -1,17 +1,16 @@
|
|||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
|
||||||
import { readLimit } from "@app/server/config/rateLimiter";
|
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|
||||||
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
|
||||||
import {
|
import {
|
||||||
CreateChefConnectionSchema,
|
CreateChefConnectionSchema,
|
||||||
SanitizedChefConnectionSchema,
|
SanitizedChefConnectionSchema,
|
||||||
UpdateChefConnectionSchema
|
UpdateChefConnectionSchema
|
||||||
} from "@app/services/app-connection/chef";
|
} from "@app/ee/services/app-connections/chef";
|
||||||
|
import { readLimit } from "@app/server/config/rateLimiter";
|
||||||
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
|
import { registerAppConnectionEndpoints } from "@app/server/routes/v1/app-connection-routers/app-connection-endpoints";
|
||||||
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
|
|
||||||
|
|
||||||
export const registerChefConnectionRouter = async (server: FastifyZodProvider) => {
|
export const registerChefConnectionRouter = async (server: FastifyZodProvider) => {
|
||||||
registerAppConnectionEndpoints({
|
registerAppConnectionEndpoints({
|
||||||
app: AppConnection.Chef,
|
app: AppConnection.Chef,
|
||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
import { ChefSyncSchema, CreateChefSyncSchema, UpdateChefSyncSchema } from "@app/services/secret-sync/chef";
|
import { ChefSyncSchema, CreateChefSyncSchema, UpdateChefSyncSchema } from "@app/ee/services/secret-sync/chef";
|
||||||
|
import { registerSyncSecretsEndpoints } from "@app/server/routes/v1/secret-sync-routers/secret-sync-endpoints";
|
||||||
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
||||||
|
|
||||||
import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints";
|
|
||||||
|
|
||||||
export const registerChefSyncRouter = async (server: FastifyZodProvider) =>
|
export const registerChefSyncRouter = async (server: FastifyZodProvider) =>
|
||||||
registerSyncSecretsEndpoints({
|
registerSyncSecretsEndpoints({
|
||||||
destination: SecretSync.Chef,
|
destination: SecretSync.Chef,
|
||||||
+1
-1
@@ -5,10 +5,10 @@ import { request } from "@app/lib/config/request";
|
|||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
import { removeTrailingSlash } from "@app/lib/fn";
|
import { removeTrailingSlash } from "@app/lib/fn";
|
||||||
import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
|
import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
|
||||||
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
|
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
|
||||||
|
|
||||||
import { TChefDataBagItemContent } from "../../secret-sync/chef/chef-sync-types";
|
import { TChefDataBagItemContent } from "../../secret-sync/chef/chef-sync-types";
|
||||||
import { AppConnection } from "../app-connection-enums";
|
|
||||||
import { ChefConnectionMethod } from "./chef-connection-enums";
|
import { ChefConnectionMethod } from "./chef-connection-enums";
|
||||||
import {
|
import {
|
||||||
TChefConnection,
|
TChefConnection,
|
||||||
+21
-3
@@ -1,7 +1,8 @@
|
|||||||
import { ForbiddenRequestError } from "@app/lib/errors";
|
import { BadRequestError, ForbiddenRequestError } from "@app/lib/errors";
|
||||||
import { OrgServiceActor } from "@app/lib/types";
|
import { OrgServiceActor } from "@app/lib/types";
|
||||||
|
|
||||||
import { AppConnection } from "../app-connection-enums";
|
import { AppConnection } from "../../../../services/app-connection/app-connection-enums";
|
||||||
|
import { TLicenseServiceFactory } from "../../license/license-service";
|
||||||
import { listChefDataBagItems, listChefDataBags } from "./chef-connection-fns";
|
import { listChefDataBagItems, listChefDataBags } from "./chef-connection-fns";
|
||||||
import { TChefConnection } from "./chef-connection-types";
|
import { TChefConnection } from "./chef-connection-types";
|
||||||
|
|
||||||
@@ -11,8 +12,23 @@ type TGetAppConnectionFunc = (
|
|||||||
actor: OrgServiceActor
|
actor: OrgServiceActor
|
||||||
) => Promise<TChefConnection>;
|
) => Promise<TChefConnection>;
|
||||||
|
|
||||||
export const chefConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
|
// Enterprise check
|
||||||
|
export const checkPlan = async (licenseService: Pick<TLicenseServiceFactory, "getPlan">, orgId: string) => {
|
||||||
|
const plan = await licenseService.getPlan(orgId);
|
||||||
|
if (!plan.enterpriseAppConnections)
|
||||||
|
throw new BadRequestError({
|
||||||
|
message:
|
||||||
|
"Failed to use app connection due to plan restriction. Upgrade plan to access enterprise app connections."
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const chefConnectionService = (
|
||||||
|
getAppConnection: TGetAppConnectionFunc,
|
||||||
|
licenseService: Pick<TLicenseServiceFactory, "getPlan">
|
||||||
|
) => {
|
||||||
const listDataBags = async (appConnectionId: string, actor: OrgServiceActor) => {
|
const listDataBags = async (appConnectionId: string, actor: OrgServiceActor) => {
|
||||||
|
await checkPlan(licenseService, actor.orgId);
|
||||||
|
|
||||||
const appConnection = await getAppConnection(AppConnection.Chef, appConnectionId, actor);
|
const appConnection = await getAppConnection(AppConnection.Chef, appConnectionId, actor);
|
||||||
|
|
||||||
if (!appConnection) {
|
if (!appConnection) {
|
||||||
@@ -23,6 +39,8 @@ export const chefConnectionService = (getAppConnection: TGetAppConnectionFunc) =
|
|||||||
};
|
};
|
||||||
|
|
||||||
const listDataBagItems = async (appConnectionId: string, dataBagName: string, actor: OrgServiceActor) => {
|
const listDataBagItems = async (appConnectionId: string, dataBagName: string, actor: OrgServiceActor) => {
|
||||||
|
await checkPlan(licenseService, actor.orgId);
|
||||||
|
|
||||||
const appConnection = await getAppConnection(AppConnection.Chef, appConnectionId, actor);
|
const appConnection = await getAppConnection(AppConnection.Chef, appConnectionId, actor);
|
||||||
|
|
||||||
if (!appConnection) {
|
if (!appConnection) {
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
|
||||||
|
import { TChefDataBagItemContent } from "@app/ee/services/secret-sync/chef";
|
||||||
import { DiscriminativePick } from "@app/lib/types";
|
import { DiscriminativePick } from "@app/lib/types";
|
||||||
import { TChefDataBagItemContent } from "@app/services/secret-sync/chef";
|
|
||||||
|
|
||||||
import { AppConnection } from "../app-connection-enums";
|
import { AppConnection } from "../../../../services/app-connection/app-connection-enums";
|
||||||
import {
|
import {
|
||||||
ChefConnectionSchema,
|
ChefConnectionSchema,
|
||||||
CreateChefConnectionSchema,
|
CreateChefConnectionSchema,
|
||||||
@@ -3,7 +3,7 @@ import net from "node:net";
|
|||||||
import { ForbiddenError } from "@casl/ability";
|
import { ForbiddenError } from "@casl/ability";
|
||||||
import * as x509 from "@peculiar/x509";
|
import * as x509 from "@peculiar/x509";
|
||||||
|
|
||||||
import { OrganizationActionScope, OrgMembershipRole, TRelays } from "@app/db/schemas";
|
import { OrganizationActionScope, OrgMembershipRole, OrgMembershipStatus, TRelays } from "@app/db/schemas";
|
||||||
import { PgSqlLock } from "@app/keystore/keystore";
|
import { PgSqlLock } from "@app/keystore/keystore";
|
||||||
import { crypto } from "@app/lib/crypto";
|
import { crypto } from "@app/lib/crypto";
|
||||||
import { DatabaseErrorCode } from "@app/lib/error-codes";
|
import { DatabaseErrorCode } from "@app/lib/error-codes";
|
||||||
@@ -909,7 +909,9 @@ export const gatewayV2ServiceFactory = ({
|
|||||||
|
|
||||||
for await (const [orgId, gateways] of Object.entries(gatewaysByOrg)) {
|
for await (const [orgId, gateways] of Object.entries(gatewaysByOrg)) {
|
||||||
try {
|
try {
|
||||||
const admins = await orgDAL.findOrgMembersByRole(orgId, OrgMembershipRole.Admin);
|
const admins = (await orgDAL.findOrgMembersByRole(orgId, OrgMembershipRole.Admin)).filter(
|
||||||
|
(admin) => admin.status !== OrgMembershipStatus.Invited
|
||||||
|
);
|
||||||
if (admins.length === 0) {
|
if (admins.length === 0) {
|
||||||
logger.warn({ orgId }, "Organization has no admins to notify about unhealthy gateway.");
|
logger.warn({ orgId }, "Organization has no admins to notify about unhealthy gateway.");
|
||||||
// eslint-disable-next-line no-continue
|
// eslint-disable-next-line no-continue
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import knex from "knex";
|
import knex from "knex";
|
||||||
import mysql, { Connection } from "mysql2/promise";
|
import mysql, { Connection } from "mysql2/promise";
|
||||||
import * as pg from "pg";
|
|
||||||
import tls, { PeerCertificate } from "tls";
|
import tls, { PeerCertificate } from "tls";
|
||||||
|
|
||||||
import { verifyHostInputValidity } from "@app/ee/services/dynamic-secret/dynamic-secret-fns";
|
import { verifyHostInputValidity } from "@app/ee/services/dynamic-secret/dynamic-secret-fns";
|
||||||
@@ -97,7 +96,7 @@ const makeSqlConnection = (
|
|||||||
try {
|
try {
|
||||||
await client.raw(SIMPLE_QUERY);
|
await client.raw(SIMPLE_QUERY);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof pg.DatabaseError) {
|
if (error instanceof Error) {
|
||||||
// Hacky way to know if we successfully hit the database.
|
// Hacky way to know if we successfully hit the database.
|
||||||
// TODO: potentially two approaches to solve the problem.
|
// TODO: potentially two approaches to solve the problem.
|
||||||
// 1. change the work flow, add account first then resource
|
// 1. change the work flow, add account first then resource
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { isIP } from "node:net";
|
|||||||
import { ForbiddenError } from "@casl/ability";
|
import { ForbiddenError } from "@casl/ability";
|
||||||
import * as x509 from "@peculiar/x509";
|
import * as x509 from "@peculiar/x509";
|
||||||
|
|
||||||
import { OrganizationActionScope, OrgMembershipRole, TRelays } from "@app/db/schemas";
|
import { OrganizationActionScope, OrgMembershipRole, OrgMembershipStatus, TRelays } from "@app/db/schemas";
|
||||||
import { PgSqlLock } from "@app/keystore/keystore";
|
import { PgSqlLock } from "@app/keystore/keystore";
|
||||||
import { crypto } from "@app/lib/crypto";
|
import { crypto } from "@app/lib/crypto";
|
||||||
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
||||||
@@ -1248,7 +1248,9 @@ export const relayServiceFactory = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const admins = await orgDAL.findOrgMembersByRole(orgId, OrgMembershipRole.Admin);
|
const admins = (await orgDAL.findOrgMembersByRole(orgId, OrgMembershipRole.Admin)).filter(
|
||||||
|
(admin) => admin.status !== OrgMembershipStatus.Invited
|
||||||
|
);
|
||||||
if (admins.length === 0) {
|
if (admins.length === 0) {
|
||||||
// eslint-disable-next-line no-continue
|
// eslint-disable-next-line no-continue
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+2
-1
@@ -6,5 +6,6 @@ export const CHEF_SYNC_LIST_OPTION: TSecretSyncListItem = {
|
|||||||
name: "Chef",
|
name: "Chef",
|
||||||
destination: SecretSync.Chef,
|
destination: SecretSync.Chef,
|
||||||
connection: AppConnection.Chef,
|
connection: AppConnection.Chef,
|
||||||
canImportSecrets: true
|
canImportSecrets: true,
|
||||||
|
enterprise: true
|
||||||
};
|
};
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { getChefDataBagItem, updateChefDataBagItem } from "@app/services/app-connection/chef";
|
import { getChefDataBagItem, updateChefDataBagItem } from "@app/ee/services/app-connections/chef";
|
||||||
import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
|
import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
|
||||||
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
|
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
|
||||||
|
|
||||||
+2
-1
@@ -42,5 +42,6 @@ export const ChefSyncListItemSchema = z.object({
|
|||||||
name: z.literal("Chef"),
|
name: z.literal("Chef"),
|
||||||
connection: z.literal(AppConnection.Chef),
|
connection: z.literal(AppConnection.Chef),
|
||||||
destination: z.literal(SecretSync.Chef),
|
destination: z.literal(SecretSync.Chef),
|
||||||
canImportSecrets: z.literal(true)
|
canImportSecrets: z.literal(true),
|
||||||
|
enterprise: z.boolean()
|
||||||
});
|
});
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
|
||||||
import { TChefConnection } from "@app/services/app-connection/chef";
|
import { TChefConnection } from "@app/ee/services/app-connections/chef";
|
||||||
|
|
||||||
import { ChefSyncListItemSchema, ChefSyncSchema, CreateChefSyncSchema } from "./chef-sync-schemas";
|
import { ChefSyncListItemSchema, ChefSyncSchema, CreateChefSyncSchema } from "./chef-sync-schemas";
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { ProjectType } from "@app/db/schemas";
|
import { ProjectType } from "@app/db/schemas";
|
||||||
|
import { ChefConnectionListItemSchema, SanitizedChefConnectionSchema } from "@app/ee/services/app-connections/chef";
|
||||||
import { OCIConnectionListItemSchema, SanitizedOCIConnectionSchema } from "@app/ee/services/app-connections/oci";
|
import { OCIConnectionListItemSchema, SanitizedOCIConnectionSchema } from "@app/ee/services/app-connections/oci";
|
||||||
import {
|
import {
|
||||||
OracleDBConnectionListItemSchema,
|
OracleDBConnectionListItemSchema,
|
||||||
@@ -48,7 +49,6 @@ import {
|
|||||||
ChecklyConnectionListItemSchema,
|
ChecklyConnectionListItemSchema,
|
||||||
SanitizedChecklyConnectionSchema
|
SanitizedChecklyConnectionSchema
|
||||||
} from "@app/services/app-connection/checkly";
|
} from "@app/services/app-connection/checkly";
|
||||||
import { ChefConnectionListItemSchema, SanitizedChefConnectionSchema } from "@app/services/app-connection/chef";
|
|
||||||
import {
|
import {
|
||||||
CloudflareConnectionListItemSchema,
|
CloudflareConnectionListItemSchema,
|
||||||
SanitizedCloudflareConnectionSchema
|
SanitizedCloudflareConnectionSchema
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { registerChefConnectionRouter } from "@app/ee/routes/v1/app-connection-routers/chef-connection-router";
|
||||||
import { registerOCIConnectionRouter } from "@app/ee/routes/v1/app-connection-routers/oci-connection-router";
|
import { registerOCIConnectionRouter } from "@app/ee/routes/v1/app-connection-routers/oci-connection-router";
|
||||||
import { registerOracleDBConnectionRouter } from "@app/ee/routes/v1/app-connection-routers/oracledb-connection-router";
|
import { registerOracleDBConnectionRouter } from "@app/ee/routes/v1/app-connection-routers/oracledb-connection-router";
|
||||||
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
@@ -13,7 +14,6 @@ import { registerAzureKeyVaultConnectionRouter } from "./azure-key-vault-connect
|
|||||||
import { registerBitbucketConnectionRouter } from "./bitbucket-connection-router";
|
import { registerBitbucketConnectionRouter } from "./bitbucket-connection-router";
|
||||||
import { registerCamundaConnectionRouter } from "./camunda-connection-router";
|
import { registerCamundaConnectionRouter } from "./camunda-connection-router";
|
||||||
import { registerChecklyConnectionRouter } from "./checkly-connection-router";
|
import { registerChecklyConnectionRouter } from "./checkly-connection-router";
|
||||||
import { registerChefConnectionRouter } from "./chef-connection-router";
|
|
||||||
import { registerCloudflareConnectionRouter } from "./cloudflare-connection-router";
|
import { registerCloudflareConnectionRouter } from "./cloudflare-connection-router";
|
||||||
import { registerDatabricksConnectionRouter } from "./databricks-connection-router";
|
import { registerDatabricksConnectionRouter } from "./databricks-connection-router";
|
||||||
import { registerDigitalOceanConnectionRouter } from "./digital-ocean-connection-router";
|
import { registerDigitalOceanConnectionRouter } from "./digital-ocean-connection-router";
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { registerChefSyncRouter } from "@app/ee/routes/v1/secret-sync-routers/chef-sync-router";
|
||||||
import { registerOCIVaultSyncRouter } from "@app/ee/routes/v1/secret-sync-routers/oci-vault-sync-router";
|
import { registerOCIVaultSyncRouter } from "@app/ee/routes/v1/secret-sync-routers/oci-vault-sync-router";
|
||||||
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
||||||
|
|
||||||
@@ -10,7 +11,6 @@ import { registerAzureKeyVaultSyncRouter } from "./azure-key-vault-sync-router";
|
|||||||
import { registerBitbucketSyncRouter } from "./bitbucket-sync-router";
|
import { registerBitbucketSyncRouter } from "./bitbucket-sync-router";
|
||||||
import { registerCamundaSyncRouter } from "./camunda-sync-router";
|
import { registerCamundaSyncRouter } from "./camunda-sync-router";
|
||||||
import { registerChecklySyncRouter } from "./checkly-sync-router";
|
import { registerChecklySyncRouter } from "./checkly-sync-router";
|
||||||
import { registerChefSyncRouter } from "./chef-sync-router";
|
|
||||||
import { registerCloudflarePagesSyncRouter } from "./cloudflare-pages-sync-router";
|
import { registerCloudflarePagesSyncRouter } from "./cloudflare-pages-sync-router";
|
||||||
import { registerCloudflareWorkersSyncRouter } from "./cloudflare-workers-sync-router";
|
import { registerCloudflareWorkersSyncRouter } from "./cloudflare-workers-sync-router";
|
||||||
import { registerDatabricksSyncRouter } from "./databricks-sync-router";
|
import { registerDatabricksSyncRouter } from "./databricks-sync-router";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
||||||
|
import { ChefSyncListItemSchema, ChefSyncSchema } from "@app/ee/services/secret-sync/chef";
|
||||||
import { OCIVaultSyncListItemSchema, OCIVaultSyncSchema } from "@app/ee/services/secret-sync/oci-vault";
|
import { OCIVaultSyncListItemSchema, OCIVaultSyncSchema } from "@app/ee/services/secret-sync/oci-vault";
|
||||||
import { ApiDocsTags, SecretSyncs } from "@app/lib/api-docs";
|
import { ApiDocsTags, SecretSyncs } from "@app/lib/api-docs";
|
||||||
import { readLimit } from "@app/server/config/rateLimiter";
|
import { readLimit } from "@app/server/config/rateLimiter";
|
||||||
@@ -24,7 +25,6 @@ import { AzureKeyVaultSyncListItemSchema, AzureKeyVaultSyncSchema } from "@app/s
|
|||||||
import { BitbucketSyncListItemSchema, BitbucketSyncSchema } from "@app/services/secret-sync/bitbucket";
|
import { BitbucketSyncListItemSchema, BitbucketSyncSchema } from "@app/services/secret-sync/bitbucket";
|
||||||
import { CamundaSyncListItemSchema, CamundaSyncSchema } from "@app/services/secret-sync/camunda";
|
import { CamundaSyncListItemSchema, CamundaSyncSchema } from "@app/services/secret-sync/camunda";
|
||||||
import { ChecklySyncListItemSchema, ChecklySyncSchema } from "@app/services/secret-sync/checkly/checkly-sync-schemas";
|
import { ChecklySyncListItemSchema, ChecklySyncSchema } from "@app/services/secret-sync/checkly/checkly-sync-schemas";
|
||||||
import { ChefSyncListItemSchema, ChefSyncSchema } from "@app/services/secret-sync/chef";
|
|
||||||
import {
|
import {
|
||||||
CloudflarePagesSyncListItemSchema,
|
CloudflarePagesSyncListItemSchema,
|
||||||
CloudflarePagesSyncSchema
|
CloudflarePagesSyncSchema
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { ProjectType } from "@app/db/schemas";
|
import { ProjectType } from "@app/db/schemas";
|
||||||
import { TAppConnections } from "@app/db/schemas/app-connections";
|
import { TAppConnections } from "@app/db/schemas/app-connections";
|
||||||
|
import {
|
||||||
|
ChefConnectionMethod,
|
||||||
|
getChefConnectionListItem,
|
||||||
|
validateChefConnectionCredentials
|
||||||
|
} from "@app/ee/services/app-connections/chef";
|
||||||
import {
|
import {
|
||||||
getOCIConnectionListItem,
|
getOCIConnectionListItem,
|
||||||
OCIConnectionMethod,
|
OCIConnectionMethod,
|
||||||
@@ -68,7 +73,6 @@ import {
|
|||||||
} from "./bitbucket";
|
} from "./bitbucket";
|
||||||
import { CamundaConnectionMethod, getCamundaConnectionListItem, validateCamundaConnectionCredentials } from "./camunda";
|
import { CamundaConnectionMethod, getCamundaConnectionListItem, validateCamundaConnectionCredentials } from "./camunda";
|
||||||
import { ChecklyConnectionMethod, getChecklyConnectionListItem, validateChecklyConnectionCredentials } from "./checkly";
|
import { ChecklyConnectionMethod, getChecklyConnectionListItem, validateChecklyConnectionCredentials } from "./checkly";
|
||||||
import { ChefConnectionMethod, getChefConnectionListItem, validateChefConnectionCredentials } from "./chef";
|
|
||||||
import { CloudflareConnectionMethod } from "./cloudflare/cloudflare-connection-enum";
|
import { CloudflareConnectionMethod } from "./cloudflare/cloudflare-connection-enum";
|
||||||
import {
|
import {
|
||||||
getCloudflareConnectionListItem,
|
getCloudflareConnectionListItem,
|
||||||
|
|||||||
@@ -86,6 +86,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
|
|||||||
[AppConnection.Netlify]: AppConnectionPlanType.Regular,
|
[AppConnection.Netlify]: AppConnectionPlanType.Regular,
|
||||||
[AppConnection.Okta]: AppConnectionPlanType.Regular,
|
[AppConnection.Okta]: AppConnectionPlanType.Regular,
|
||||||
[AppConnection.Redis]: AppConnectionPlanType.Regular,
|
[AppConnection.Redis]: AppConnectionPlanType.Regular,
|
||||||
[AppConnection.Chef]: AppConnectionPlanType.Regular,
|
[AppConnection.Chef]: AppConnectionPlanType.Enterprise,
|
||||||
[AppConnection.Northflank]: AppConnectionPlanType.Regular
|
[AppConnection.Northflank]: AppConnectionPlanType.Regular
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { ForbiddenError, subject } from "@casl/ability";
|
import { ForbiddenError, subject } from "@casl/ability";
|
||||||
|
|
||||||
import { ActionProjectType, OrganizationActionScope, TAppConnections } from "@app/db/schemas";
|
import { ActionProjectType, OrganizationActionScope, TAppConnections } from "@app/db/schemas";
|
||||||
|
import { ValidateChefConnectionCredentialsSchema } from "@app/ee/services/app-connections/chef";
|
||||||
|
import { chefConnectionService } from "@app/ee/services/app-connections/chef/chef-connection-service";
|
||||||
import { ValidateOCIConnectionCredentialsSchema } from "@app/ee/services/app-connections/oci";
|
import { ValidateOCIConnectionCredentialsSchema } from "@app/ee/services/app-connections/oci";
|
||||||
import { ociConnectionService } from "@app/ee/services/app-connections/oci/oci-connection-service";
|
import { ociConnectionService } from "@app/ee/services/app-connections/oci/oci-connection-service";
|
||||||
import { ValidateOracleDBConnectionCredentialsSchema } from "@app/ee/services/app-connections/oracledb";
|
import { ValidateOracleDBConnectionCredentialsSchema } from "@app/ee/services/app-connections/oracledb";
|
||||||
@@ -67,8 +69,6 @@ import { ValidateCamundaConnectionCredentialsSchema } from "./camunda";
|
|||||||
import { camundaConnectionService } from "./camunda/camunda-connection-service";
|
import { camundaConnectionService } from "./camunda/camunda-connection-service";
|
||||||
import { ValidateChecklyConnectionCredentialsSchema } from "./checkly";
|
import { ValidateChecklyConnectionCredentialsSchema } from "./checkly";
|
||||||
import { checklyConnectionService } from "./checkly/checkly-connection-service";
|
import { checklyConnectionService } from "./checkly/checkly-connection-service";
|
||||||
import { ValidateChefConnectionCredentialsSchema } from "./chef";
|
|
||||||
import { chefConnectionService } from "./chef/chef-connection-service";
|
|
||||||
import { ValidateCloudflareConnectionCredentialsSchema } from "./cloudflare/cloudflare-connection-schema";
|
import { ValidateCloudflareConnectionCredentialsSchema } from "./cloudflare/cloudflare-connection-schema";
|
||||||
import { cloudflareConnectionService } from "./cloudflare/cloudflare-connection-service";
|
import { cloudflareConnectionService } from "./cloudflare/cloudflare-connection-service";
|
||||||
import { ValidateDatabricksConnectionCredentialsSchema } from "./databricks";
|
import { ValidateDatabricksConnectionCredentialsSchema } from "./databricks";
|
||||||
@@ -885,6 +885,6 @@ export const appConnectionServiceFactory = ({
|
|||||||
northflank: northflankConnectionService(connectAppConnectionById),
|
northflank: northflankConnectionService(connectAppConnectionById),
|
||||||
okta: oktaConnectionService(connectAppConnectionById),
|
okta: oktaConnectionService(connectAppConnectionById),
|
||||||
laravelForge: laravelForgeConnectionService(connectAppConnectionById),
|
laravelForge: laravelForgeConnectionService(connectAppConnectionById),
|
||||||
chef: chefConnectionService(connectAppConnectionById)
|
chef: chefConnectionService(connectAppConnectionById, licenseService)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
import {
|
||||||
|
TChefConnection,
|
||||||
|
TChefConnectionConfig,
|
||||||
|
TChefConnectionInput,
|
||||||
|
TValidateChefConnectionCredentialsSchema
|
||||||
|
} from "@app/ee/services/app-connections/chef";
|
||||||
import {
|
import {
|
||||||
TOCIConnection,
|
TOCIConnection,
|
||||||
TOCIConnectionConfig,
|
TOCIConnectionConfig,
|
||||||
@@ -82,12 +88,6 @@ import {
|
|||||||
TChecklyConnectionInput,
|
TChecklyConnectionInput,
|
||||||
TValidateChecklyConnectionCredentialsSchema
|
TValidateChecklyConnectionCredentialsSchema
|
||||||
} from "./checkly";
|
} from "./checkly";
|
||||||
import {
|
|
||||||
TChefConnection,
|
|
||||||
TChefConnectionConfig,
|
|
||||||
TChefConnectionInput,
|
|
||||||
TValidateChefConnectionCredentialsSchema
|
|
||||||
} from "./chef";
|
|
||||||
import {
|
import {
|
||||||
TCloudflareConnection,
|
TCloudflareConnection,
|
||||||
TCloudflareConnectionConfig,
|
TCloudflareConnectionConfig,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import handlebars from "handlebars";
|
|||||||
import { TGatewayServiceFactory } from "@app/ee/services/gateway/gateway-service";
|
import { TGatewayServiceFactory } from "@app/ee/services/gateway/gateway-service";
|
||||||
import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
|
import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
|
||||||
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
|
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
|
||||||
|
import { CHEF_SYNC_LIST_OPTION, ChefSyncFns } from "@app/ee/services/secret-sync/chef";
|
||||||
import { OCI_VAULT_SYNC_LIST_OPTION, OCIVaultSyncFns } from "@app/ee/services/secret-sync/oci-vault";
|
import { OCI_VAULT_SYNC_LIST_OPTION, OCIVaultSyncFns } from "@app/ee/services/secret-sync/oci-vault";
|
||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
import {
|
import {
|
||||||
@@ -34,7 +35,6 @@ import { BITBUCKET_SYNC_LIST_OPTION, BitbucketSyncFns } from "./bitbucket";
|
|||||||
import { CAMUNDA_SYNC_LIST_OPTION, camundaSyncFactory } from "./camunda";
|
import { CAMUNDA_SYNC_LIST_OPTION, camundaSyncFactory } from "./camunda";
|
||||||
import { CHECKLY_SYNC_LIST_OPTION } from "./checkly/checkly-sync-constants";
|
import { CHECKLY_SYNC_LIST_OPTION } from "./checkly/checkly-sync-constants";
|
||||||
import { ChecklySyncFns } from "./checkly/checkly-sync-fns";
|
import { ChecklySyncFns } from "./checkly/checkly-sync-fns";
|
||||||
import { CHEF_SYNC_LIST_OPTION, ChefSyncFns } from "./chef";
|
|
||||||
import { CLOUDFLARE_PAGES_SYNC_LIST_OPTION } from "./cloudflare-pages/cloudflare-pages-constants";
|
import { CLOUDFLARE_PAGES_SYNC_LIST_OPTION } from "./cloudflare-pages/cloudflare-pages-constants";
|
||||||
import { CloudflarePagesSyncFns } from "./cloudflare-pages/cloudflare-pages-fns";
|
import { CloudflarePagesSyncFns } from "./cloudflare-pages/cloudflare-pages-fns";
|
||||||
import { CLOUDFLARE_WORKERS_SYNC_LIST_OPTION, CloudflareWorkersSyncFns } from "./cloudflare-workers";
|
import { CLOUDFLARE_WORKERS_SYNC_LIST_OPTION, CloudflareWorkersSyncFns } from "./cloudflare-workers";
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {
|
|||||||
[SecretSync.Northflank]: SecretSyncPlanType.Regular,
|
[SecretSync.Northflank]: SecretSyncPlanType.Regular,
|
||||||
[SecretSync.Bitbucket]: SecretSyncPlanType.Regular,
|
[SecretSync.Bitbucket]: SecretSyncPlanType.Regular,
|
||||||
[SecretSync.LaravelForge]: SecretSyncPlanType.Regular,
|
[SecretSync.LaravelForge]: SecretSyncPlanType.Regular,
|
||||||
[SecretSync.Chef]: SecretSyncPlanType.Regular
|
[SecretSync.Chef]: SecretSyncPlanType.Enterprise
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {
|
export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import { Job } from "bullmq";
|
import { Job } from "bullmq";
|
||||||
|
|
||||||
import { AuditLogInfo } from "@app/ee/services/audit-log/audit-log-types";
|
import { AuditLogInfo } from "@app/ee/services/audit-log/audit-log-types";
|
||||||
|
import {
|
||||||
|
TChefSync,
|
||||||
|
TChefSyncInput,
|
||||||
|
TChefSyncListItem,
|
||||||
|
TChefSyncWithCredentials
|
||||||
|
} from "@app/ee/services/secret-sync/chef";
|
||||||
import {
|
import {
|
||||||
TOCIVaultSync,
|
TOCIVaultSync,
|
||||||
TOCIVaultSyncInput,
|
TOCIVaultSyncInput,
|
||||||
@@ -21,7 +27,6 @@ import {
|
|||||||
TCamundaSyncListItem,
|
TCamundaSyncListItem,
|
||||||
TCamundaSyncWithCredentials
|
TCamundaSyncWithCredentials
|
||||||
} from "@app/services/secret-sync/camunda";
|
} from "@app/services/secret-sync/camunda";
|
||||||
import { TChefSync, TChefSyncInput, TChefSyncListItem, TChefSyncWithCredentials } from "@app/services/secret-sync/chef";
|
|
||||||
import {
|
import {
|
||||||
TDatabricksSync,
|
TDatabricksSync,
|
||||||
TDatabricksSyncInput,
|
TDatabricksSyncInput,
|
||||||
|
|||||||
+4
-1
@@ -784,7 +784,10 @@
|
|||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
"group": "Infisical PAM",
|
"group": "Infisical PAM",
|
||||||
"pages": ["documentation/platform/pam/overview"]
|
"pages": [
|
||||||
|
"documentation/platform/pam/overview",
|
||||||
|
"documentation/platform/pam/session-recording"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
title: "Session Recording"
|
||||||
|
sidebarTitle: "Session Recording"
|
||||||
|
description: "Learn how Infisical records and stores session activity for auditing and monitoring."
|
||||||
|
---
|
||||||
|
|
||||||
|
Infisical's Privileged Access Management (PAM) provides robust session recording capabilities to help you audit and monitor user activity across your infrastructure.
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
When a user initiates a session through the Infisical Gateway, a recording of the session begins. The gateway securely caches all recording data in temporary encrypted files on its local system.
|
||||||
|
|
||||||
|
Once the session concludes, the gateway transmits the complete recording to the Infisical platform for long-term, centralized storage. This asynchronous process ensures that sessions remain operational even if the connection to the Infisical platform is temporarily lost. After the upload is complete, administrators can search and review the session logs in the Infisical UI.
|
||||||
|
|
||||||
|
## What's Captured
|
||||||
|
|
||||||
|
The content captured during a session depends on the type of resource being accessed.
|
||||||
|
|
||||||
|
### Database Sessions
|
||||||
|
|
||||||
|
For database connections, Infisical captures all queries executed and their corresponding responses.
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
Support for additional resource types like SSH and RDP is coming soon.
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
## Viewing Recordings
|
||||||
|
|
||||||
|
To review session recordings:
|
||||||
|
|
||||||
|
1. Navigate to the **PAM Sessions** page in your project.
|
||||||
|
2. Click on a session from the list to view its details.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The session details page provides key information, including the complete session logs, connection status, the user who initiated it, and more.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Searching Logs
|
||||||
|
|
||||||
|
You can use the search bar to quickly find relevant information:
|
||||||
|
|
||||||
|
- **On the main Sessions page:** Search across all session logs to locate specific queries or outputs.
|
||||||
|
- **On an individual session page:** Search within that specific session's logs to pinpoint activity.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
<AccordionGroup>
|
||||||
|
<Accordion title="Are session recordings encrypted?">
|
||||||
|
Yes. All session recordings are encrypted at rest by default, ensuring your audit data is always secure.
|
||||||
|
</Accordion>
|
||||||
|
<Accordion title="Why aren't recordings streamed in real-time?">
|
||||||
|
Currently, Infisical uses an asynchronous approach where the gateway records the entire session locally before uploading it. This design makes your PAM sessions more resilient, as they don't depend on a constant, active connection to the Infisical platform. We may introduce live streaming capabilities in a future release.
|
||||||
|
</Accordion>
|
||||||
|
</AccordionGroup>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 415 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 462 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 500 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 570 KiB |
@@ -3,6 +3,14 @@ title: "Chef Connection"
|
|||||||
description: "Learn how to configure a Chef Connection for Infisical."
|
description: "Learn how to configure a Chef Connection for Infisical."
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<Info>
|
||||||
|
Chef App Connection is a paid feature.
|
||||||
|
|
||||||
|
If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical,
|
||||||
|
then you should contact [email protected] to purchase an enterprise license to use it.
|
||||||
|
|
||||||
|
</Info>
|
||||||
|
|
||||||
Infisical supports the use of User Private Key to connect with Chef Server.
|
Infisical supports the use of User Private Key to connect with Chef Server.
|
||||||
|
|
||||||
Please access your **starter kit** to get all the required information to create a Chef Connection.
|
Please access your **starter kit** to get all the required information to create a Chef Connection.
|
||||||
|
|||||||
@@ -3,6 +3,14 @@ title: "Chef Sync"
|
|||||||
description: "Learn how to configure a Chef Sync for Infisical."
|
description: "Learn how to configure a Chef Sync for Infisical."
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<Info>
|
||||||
|
Chef Sync is a paid feature.
|
||||||
|
|
||||||
|
If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical,
|
||||||
|
then you should contact [email protected] to purchase an enterprise license to use it.
|
||||||
|
|
||||||
|
</Info>
|
||||||
|
|
||||||
**Prerequisites:**
|
**Prerequisites:**
|
||||||
|
|
||||||
- Create a [Chef Connection](/integrations/app-connections/chef)
|
- Create a [Chef Connection](/integrations/app-connections/chef)
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ Both approaches provide the same metrics data in OTEL format, so you can choose
|
|||||||
- Access to deploy monitoring services (Prometheus, Grafana, etc.)
|
- Access to deploy monitoring services (Prometheus, Grafana, etc.)
|
||||||
- Basic understanding of Prometheus and Grafana
|
- Basic understanding of Prometheus and Grafana
|
||||||
|
|
||||||
## Environment Variables
|
## Setup
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
Configure the following environment variables in your Infisical backend:
|
Configure the following environment variables in your Infisical backend:
|
||||||
|
|
||||||
@@ -37,287 +39,304 @@ OTEL_TELEMETRY_COLLECTION_ENABLED=true
|
|||||||
|
|
||||||
# Choose export type: "prometheus" or "otlp"
|
# Choose export type: "prometheus" or "otlp"
|
||||||
OTEL_EXPORT_TYPE=prometheus
|
OTEL_EXPORT_TYPE=prometheus
|
||||||
|
|
||||||
# For OTLP push mode, also configure:
|
|
||||||
# OTEL_EXPORT_OTLP_ENDPOINT=http://otel-collector:4318/v1/metrics
|
|
||||||
# OTEL_COLLECTOR_BASIC_AUTH_USERNAME=your_collector_username
|
|
||||||
# OTEL_COLLECTOR_BASIC_AUTH_PASSWORD=your_collector_password
|
|
||||||
# OTEL_OTLP_PUSH_INTERVAL=30000
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note**: The `OTEL_COLLECTOR_BASIC_AUTH_USERNAME` and `OTEL_COLLECTOR_BASIC_AUTH_PASSWORD` values must match the credentials configured in your OpenTelemetry Collector's `basicauth/server` extension. These are not hardcoded values - you configure them in your collector configuration file.
|
<Tabs>
|
||||||
|
<Tab title="Pull-based Monitoring (Prometheus)">
|
||||||
|
This approach exposes metrics on port 9464 at the `/metrics` endpoint, allowing Prometheus to scrape the data. The metrics are exposed in Prometheus format but originate from OpenTelemetry instrumentation.
|
||||||
|
|
||||||
## Option 1: Pull-based Monitoring (Prometheus)
|
### Configuration
|
||||||
|
|
||||||
This approach exposes metrics on port 9464 at the `/metrics` endpoint, allowing Prometheus to scrape the data. The metrics are exposed in Prometheus format but originate from OpenTelemetry instrumentation.
|
<Steps>
|
||||||
|
<Step title="Enable Prometheus export in Infisical">
|
||||||
|
```bash
|
||||||
|
OTEL_TELEMETRY_COLLECTION_ENABLED=true
|
||||||
|
OTEL_EXPORT_TYPE=prometheus
|
||||||
|
```
|
||||||
|
</Step>
|
||||||
|
|
||||||
### Configuration
|
<Step title="Expose the metrics port">
|
||||||
|
Expose the metrics port in your Infisical backend:
|
||||||
|
|
||||||
1. **Enable Prometheus export in Infisical**:
|
- **Docker**: Expose port 9464
|
||||||
|
- **Kubernetes**: Create a service exposing port 9464
|
||||||
|
- **Other**: Ensure port 9464 is accessible to your monitoring stack
|
||||||
|
</Step>
|
||||||
|
|
||||||
```bash
|
<Step title="Create Prometheus configuration">
|
||||||
OTEL_TELEMETRY_COLLECTION_ENABLED=true
|
Create `prometheus.yml`:
|
||||||
OTEL_EXPORT_TYPE=prometheus
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Expose the metrics port** in your Infisical backend:
|
|
||||||
|
|
||||||
- **Docker**: Expose port 9464
|
|
||||||
- **Kubernetes**: Create a service exposing port 9464
|
|
||||||
- **Other**: Ensure port 9464 is accessible to your monitoring stack
|
|
||||||
|
|
||||||
3. **Create Prometheus configuration** (`prometheus.yml`):
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
global:
|
|
||||||
scrape_interval: 30s
|
|
||||||
evaluation_interval: 30s
|
|
||||||
|
|
||||||
scrape_configs:
|
|
||||||
- job_name: "infisical"
|
|
||||||
scrape_interval: 30s
|
|
||||||
static_configs:
|
|
||||||
- targets: ["infisical-backend:9464"] # Adjust hostname/port based on your deployment
|
|
||||||
metrics_path: "/metrics"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note**: Replace `infisical-backend:9464` with the actual hostname and port where your Infisical backend is running. This could be:
|
|
||||||
|
|
||||||
- **Docker Compose**: `infisical-backend:9464` (service name)
|
|
||||||
- **Kubernetes**: `infisical-backend.default.svc.cluster.local:9464` (service name)
|
|
||||||
- **Bare Metal**: `192.168.1.100:9464` (actual IP address)
|
|
||||||
- **Cloud**: `your-infisical.example.com:9464` (domain name)
|
|
||||||
|
|
||||||
### Deployment Options
|
|
||||||
|
|
||||||
#### Docker Compose
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
global:
|
||||||
|
scrape_interval: 30s
|
||||||
|
evaluation_interval: 30s
|
||||||
|
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: "infisical"
|
||||||
|
scrape_interval: 30s
|
||||||
|
static_configs:
|
||||||
|
- targets: ["infisical-backend:9464"] # Adjust hostname/port based on your deployment
|
||||||
|
metrics_path: "/metrics"
|
||||||
|
```
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
Replace `infisical-backend:9464` with the actual hostname and port where your Infisical backend is running. This could be:
|
||||||
|
|
||||||
|
- **Docker Compose**: `infisical-backend:9464` (service name)
|
||||||
|
- **Kubernetes**: `infisical-backend.default.svc.cluster.local:9464` (service name)
|
||||||
|
- **Bare Metal**: `192.168.1.100:9464` (actual IP address)
|
||||||
|
- **Cloud**: `your-infisical.example.com:9464` (domain name)
|
||||||
|
</Note>
|
||||||
|
</Step>
|
||||||
|
</Steps>
|
||||||
|
|
||||||
|
### Deployment Options
|
||||||
|
|
||||||
|
Once you've configured Infisical to expose metrics, you'll need to deploy Prometheus to scrape and store them. Below are examples for different deployment environments. Choose the option that matches your infrastructure.
|
||||||
|
|
||||||
|
<Tabs>
|
||||||
|
<Tab title="Docker Compose">
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
prometheus:
|
||||||
|
image: prom/prometheus:latest
|
||||||
|
ports:
|
||||||
|
- "9090:9090"
|
||||||
|
volumes:
|
||||||
|
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||||
|
command:
|
||||||
|
- "--config.file=/etc/prometheus/prometheus.yml"
|
||||||
|
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana:latest
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
- GF_SECURITY_ADMIN_USER=admin
|
||||||
|
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||||||
|
```
|
||||||
|
</Tab>
|
||||||
|
<Tab title="Kubernetes">
|
||||||
|
```yaml
|
||||||
|
# prometheus-deployment.yaml
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: prometheus
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: prometheus
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: prometheus
|
||||||
|
image: prom/prometheus:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 9090
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /etc/prometheus
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: prometheus-config
|
||||||
|
|
||||||
|
---
|
||||||
|
# prometheus-service.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: prometheus
|
||||||
|
ports:
|
||||||
|
- port: 9090
|
||||||
|
targetPort: 9090
|
||||||
|
type: ClusterIP
|
||||||
|
```
|
||||||
|
</Tab>
|
||||||
|
<Tab title="Helm">
|
||||||
|
```bash
|
||||||
|
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
|
||||||
|
helm install prometheus prometheus-community/prometheus \
|
||||||
|
--set server.config.global.scrape_interval=30s \
|
||||||
|
--set server.config.scrape_configs[0].job_name=infisical \
|
||||||
|
--set server.config.scrape_configs[0].static_configs[0].targets[0]=infisical-backend:9464
|
||||||
|
```
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
|
</Tab>
|
||||||
|
<Tab title="Push-based Monitoring (OTLP)">
|
||||||
|
This approach sends metrics directly to an OpenTelemetry Collector via the OTLP protocol. This gives you the most flexibility as you can configure the collector to export to multiple backends simultaneously.
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
<Steps>
|
||||||
|
<Step title="Enable OTLP export in Infisical">
|
||||||
|
```bash
|
||||||
|
OTEL_TELEMETRY_COLLECTION_ENABLED=true
|
||||||
|
OTEL_EXPORT_TYPE=otlp
|
||||||
|
OTEL_EXPORT_OTLP_ENDPOINT=http://otel-collector:4318/v1/metrics
|
||||||
|
OTEL_COLLECTOR_BASIC_AUTH_USERNAME=infisical
|
||||||
|
OTEL_COLLECTOR_BASIC_AUTH_PASSWORD=infisical
|
||||||
|
OTEL_OTLP_PUSH_INTERVAL=30000
|
||||||
|
```
|
||||||
|
</Step>
|
||||||
|
|
||||||
|
<Step title="Create OpenTelemetry Collector configuration">
|
||||||
|
Create `otel-collector-config.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
extensions:
|
||||||
|
health_check:
|
||||||
|
pprof:
|
||||||
|
zpages:
|
||||||
|
basicauth/server:
|
||||||
|
htpasswd:
|
||||||
|
inline: |
|
||||||
|
your_username:your_password
|
||||||
|
|
||||||
|
receivers:
|
||||||
|
otlp:
|
||||||
|
protocols:
|
||||||
|
http:
|
||||||
|
endpoint: 0.0.0.0:4318
|
||||||
|
auth:
|
||||||
|
authenticator: basicauth/server
|
||||||
|
|
||||||
prometheus:
|
prometheus:
|
||||||
image: prom/prometheus:latest
|
config:
|
||||||
ports:
|
scrape_configs:
|
||||||
- "9090:9090"
|
- job_name: otel-collector
|
||||||
volumes:
|
scrape_interval: 30s
|
||||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
static_configs:
|
||||||
command:
|
- targets: [infisical-backend:9464]
|
||||||
- "--config.file=/etc/prometheus/prometheus.yml"
|
metric_relabel_configs:
|
||||||
|
- action: labeldrop
|
||||||
|
regex: "service_instance_id|service_name"
|
||||||
|
|
||||||
grafana:
|
processors:
|
||||||
image: grafana/grafana:latest
|
batch:
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
exporters:
|
||||||
environment:
|
prometheus:
|
||||||
- GF_SECURITY_ADMIN_USER=admin
|
endpoint: "0.0.0.0:8889"
|
||||||
- GF_SECURITY_ADMIN_PASSWORD=admin
|
auth:
|
||||||
|
authenticator: basicauth/server
|
||||||
|
resource_to_telemetry_conversion:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
service:
|
||||||
|
extensions: [basicauth/server, health_check, pprof, zpages]
|
||||||
|
pipelines:
|
||||||
|
metrics:
|
||||||
|
receivers: [otlp]
|
||||||
|
processors: [batch]
|
||||||
|
exporters: [prometheus]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Kubernetes
|
<Warning>
|
||||||
|
Replace `your_username:your_password` with your chosen credentials. These must match the values you set in Infisical's `OTEL_COLLECTOR_BASIC_AUTH_USERNAME` and `OTEL_COLLECTOR_BASIC_AUTH_PASSWORD` environment variables.
|
||||||
|
</Warning>
|
||||||
|
</Step>
|
||||||
|
|
||||||
|
<Step title="Create Prometheus configuration">
|
||||||
|
Create Prometheus configuration for the collector:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# prometheus-deployment.yaml
|
global:
|
||||||
apiVersion: apps/v1
|
scrape_interval: 30s
|
||||||
kind: Deployment
|
evaluation_interval: 30s
|
||||||
metadata:
|
|
||||||
name: prometheus
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: prometheus
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: prometheus
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: prometheus
|
|
||||||
image: prom/prometheus:latest
|
|
||||||
ports:
|
|
||||||
- containerPort: 9090
|
|
||||||
volumeMounts:
|
|
||||||
- name: config
|
|
||||||
mountPath: /etc/prometheus
|
|
||||||
volumes:
|
|
||||||
- name: config
|
|
||||||
configMap:
|
|
||||||
name: prometheus-config
|
|
||||||
|
|
||||||
---
|
scrape_configs:
|
||||||
# prometheus-service.yaml
|
- job_name: "otel-collector"
|
||||||
apiVersion: v1
|
scrape_interval: 30s
|
||||||
kind: Service
|
static_configs:
|
||||||
metadata:
|
- targets: ["otel-collector:8889"] # Adjust hostname/port based on your deployment
|
||||||
name: prometheus
|
metrics_path: "/metrics"
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: prometheus
|
|
||||||
ports:
|
|
||||||
- port: 9090
|
|
||||||
targetPort: 9090
|
|
||||||
type: ClusterIP
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Helm
|
<Note>
|
||||||
|
Replace `otel-collector:8889` with the actual hostname and port where your OpenTelemetry Collector is running. This could be:
|
||||||
|
|
||||||
```bash
|
- **Docker Compose**: `otel-collector:8889` (service name)
|
||||||
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
|
- **Kubernetes**: `otel-collector.default.svc.cluster.local:8889` (service name)
|
||||||
helm install prometheus prometheus-community/prometheus \
|
- **Bare Metal**: `192.168.1.100:8889` (actual IP address)
|
||||||
--set server.config.global.scrape_interval=30s \
|
- **Cloud**: `your-collector.example.com:8889` (domain name)
|
||||||
--set server.config.scrape_configs[0].job_name=infisical \
|
</Note>
|
||||||
--set server.config.scrape_configs[0].static_configs[0].targets[0]=infisical-backend:9464
|
</Step>
|
||||||
```
|
</Steps>
|
||||||
|
|
||||||
## Option 2: Push-based Monitoring (OTLP)
|
### Deployment Options
|
||||||
|
|
||||||
This approach sends metrics directly to an OpenTelemetry Collector via the OTLP protocol. This gives you the most flexibility as you can configure the collector to export to multiple backends simultaneously.
|
After configuring Infisical and the OpenTelemetry Collector, you'll need to deploy the collector to receive metrics from Infisical. Below are examples for different deployment environments. Choose the option that matches your infrastructure.
|
||||||
|
|
||||||
### Configuration
|
<Tabs>
|
||||||
|
<Tab title="Docker Compose">
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
otel-collector:
|
||||||
|
image: otel/opentelemetry-collector-contrib:latest
|
||||||
|
ports:
|
||||||
|
- 4318:4318 # OTLP http receiver
|
||||||
|
- 8889:8889 # Prometheus exporter metrics
|
||||||
|
volumes:
|
||||||
|
- ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml:ro
|
||||||
|
command:
|
||||||
|
- "--config=/etc/otelcol-contrib/config.yaml"
|
||||||
|
```
|
||||||
|
</Tab>
|
||||||
|
<Tab title="Kubernetes">
|
||||||
|
```yaml
|
||||||
|
# otel-collector-deployment.yaml
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: otel-collector
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: otel-collector
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: otel-collector
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: otel-collector
|
||||||
|
image: otel/opentelemetry-collector-contrib:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 4318
|
||||||
|
- containerPort: 8889
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /etc/otelcol-contrib
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: otel-collector-config
|
||||||
|
```
|
||||||
|
</Tab>
|
||||||
|
<Tab title="Helm">
|
||||||
|
```bash
|
||||||
|
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
|
||||||
|
helm install otel-collector open-telemetry/opentelemetry-collector \
|
||||||
|
--set config.receivers.otlp.protocols.http.endpoint=0.0.0.0:4318 \
|
||||||
|
--set config.exporters.prometheus.endpoint=0.0.0.0:8889
|
||||||
|
```
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
1. **Enable OTLP export in Infisical**:
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
```bash
|
|
||||||
OTEL_TELEMETRY_COLLECTION_ENABLED=true
|
|
||||||
OTEL_EXPORT_TYPE=otlp
|
|
||||||
OTEL_EXPORT_OTLP_ENDPOINT=http://otel-collector:4318/v1/metrics
|
|
||||||
OTEL_COLLECTOR_BASIC_AUTH_USERNAME=infisical
|
|
||||||
OTEL_COLLECTOR_BASIC_AUTH_PASSWORD=infisical
|
|
||||||
OTEL_OTLP_PUSH_INTERVAL=30000
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Create OpenTelemetry Collector configuration** (`otel-collector-config.yaml`):
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
extensions:
|
|
||||||
health_check:
|
|
||||||
pprof:
|
|
||||||
zpages:
|
|
||||||
basicauth/server:
|
|
||||||
htpasswd:
|
|
||||||
inline: |
|
|
||||||
your_username:your_password
|
|
||||||
|
|
||||||
receivers:
|
|
||||||
otlp:
|
|
||||||
protocols:
|
|
||||||
http:
|
|
||||||
endpoint: 0.0.0.0:4318
|
|
||||||
auth:
|
|
||||||
authenticator: basicauth/server
|
|
||||||
|
|
||||||
prometheus:
|
|
||||||
config:
|
|
||||||
scrape_configs:
|
|
||||||
- job_name: otel-collector
|
|
||||||
scrape_interval: 30s
|
|
||||||
static_configs:
|
|
||||||
- targets: [infisical-backend:9464]
|
|
||||||
metric_relabel_configs:
|
|
||||||
- action: labeldrop
|
|
||||||
regex: "service_instance_id|service_name"
|
|
||||||
|
|
||||||
processors:
|
|
||||||
batch:
|
|
||||||
|
|
||||||
exporters:
|
|
||||||
prometheus:
|
|
||||||
endpoint: "0.0.0.0:8889"
|
|
||||||
auth:
|
|
||||||
authenticator: basicauth/server
|
|
||||||
resource_to_telemetry_conversion:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
service:
|
|
||||||
extensions: [basicauth/server, health_check, pprof, zpages]
|
|
||||||
pipelines:
|
|
||||||
metrics:
|
|
||||||
receivers: [otlp]
|
|
||||||
processors: [batch]
|
|
||||||
exporters: [prometheus]
|
|
||||||
```
|
|
||||||
|
|
||||||
**Important**: Replace `your_username:your_password` with your chosen credentials. These must match the values you set in Infisical's `OTEL_COLLECTOR_BASIC_AUTH_USERNAME` and `OTEL_COLLECTOR_BASIC_AUTH_PASSWORD` environment variables.
|
|
||||||
|
|
||||||
3. **Create Prometheus configuration** for the collector:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
global:
|
|
||||||
scrape_interval: 30s
|
|
||||||
evaluation_interval: 30s
|
|
||||||
|
|
||||||
scrape_configs:
|
|
||||||
- job_name: "otel-collector"
|
|
||||||
scrape_interval: 30s
|
|
||||||
static_configs:
|
|
||||||
- targets: ["otel-collector:8889"] # Adjust hostname/port based on your deployment
|
|
||||||
metrics_path: "/metrics"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note**: Replace `otel-collector:8889` with the actual hostname and port where your OpenTelemetry Collector is running. This could be:
|
|
||||||
|
|
||||||
- **Docker Compose**: `otel-collector:8889` (service name)
|
|
||||||
- **Kubernetes**: `otel-collector.default.svc.cluster.local:8889` (service name)
|
|
||||||
- **Bare Metal**: `192.168.1.100:8889` (actual IP address)
|
|
||||||
- **Cloud**: `your-collector.example.com:8889` (domain name)
|
|
||||||
|
|
||||||
### Deployment Options
|
|
||||||
|
|
||||||
#### Docker Compose
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
services:
|
|
||||||
otel-collector:
|
|
||||||
image: otel/opentelemetry-collector-contrib:latest
|
|
||||||
ports:
|
|
||||||
- 4318:4318 # OTLP http receiver
|
|
||||||
- 8889:8889 # Prometheus exporter metrics
|
|
||||||
volumes:
|
|
||||||
- ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml:ro
|
|
||||||
command:
|
|
||||||
- "--config=/etc/otelcol-contrib/config.yaml"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Kubernetes
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# otel-collector-deployment.yaml
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: otel-collector
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: otel-collector
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: otel-collector
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: otel-collector
|
|
||||||
image: otel/opentelemetry-collector-contrib:latest
|
|
||||||
ports:
|
|
||||||
- containerPort: 4318
|
|
||||||
- containerPort: 8889
|
|
||||||
volumeMounts:
|
|
||||||
- name: config
|
|
||||||
mountPath: /etc/otelcol-contrib
|
|
||||||
volumes:
|
|
||||||
- name: config
|
|
||||||
configMap:
|
|
||||||
name: otel-collector-config
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Helm
|
|
||||||
|
|
||||||
```bash
|
|
||||||
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
|
|
||||||
helm install otel-collector open-telemetry/opentelemetry-collector \
|
|
||||||
--set config.receivers.otlp.protocols.http.endpoint=0.0.0.0:4318 \
|
|
||||||
--set config.exporters.prometheus.endpoint=0.0.0.0:8889
|
|
||||||
```
|
|
||||||
|
|
||||||
## Available Metrics
|
## Available Metrics
|
||||||
|
|
||||||
@@ -327,166 +346,211 @@ Infisical exposes the following key metrics in OpenTelemetry format:
|
|||||||
|
|
||||||
These metrics track all HTTP API requests to Infisical, including request counts, latency, and errors. Use these to monitor overall API health, identify performance bottlenecks, and track usage patterns across users and machine identities.
|
These metrics track all HTTP API requests to Infisical, including request counts, latency, and errors. Use these to monitor overall API health, identify performance bottlenecks, and track usage patterns across users and machine identities.
|
||||||
|
|
||||||
#### Total API Requests
|
<AccordionGroup>
|
||||||
|
<Accordion title="Total API Requests">
|
||||||
|
**Metric Name**: `infisical.http.server.request.count`
|
||||||
|
|
||||||
- **Metric Name**: `infisical.http.server.request.count`
|
**Type**: Counter
|
||||||
- **Type**: Counter
|
|
||||||
- **Unit**: `{request}`
|
|
||||||
- **Description**: Total number of API requests to Infisical (covers both human users and machine identities)
|
|
||||||
- **Attributes**:
|
|
||||||
- `infisical.organization.id` (string): Organization ID
|
|
||||||
- `infisical.organization.name` (string): Organization name (e.g., "Platform Engineering Team")
|
|
||||||
- `infisical.user.id` (string, optional): User ID if human user
|
|
||||||
- `infisical.user.email` (string, optional): User email (e.g., "[email protected]")
|
|
||||||
- `infisical.identity.id` (string, optional): Machine identity ID
|
|
||||||
- `infisical.identity.name` (string, optional): Machine identity name (e.g., "prod-k8s-operator")
|
|
||||||
- `infisical.auth.method` (string, optional): Auth method used
|
|
||||||
- `http.request.method` (string): HTTP method (GET, POST, PUT, DELETE)
|
|
||||||
- `http.route` (string): API endpoint route pattern
|
|
||||||
- `http.response.status_code` (int): HTTP status code
|
|
||||||
- `infisical.project.id` (string, optional): Project ID
|
|
||||||
- `infisical.project.name` (string, optional): Project name
|
|
||||||
- `user_agent.original` (string, optional): User agent string
|
|
||||||
- `client.address` (string, optional): IP address
|
|
||||||
|
|
||||||
#### Request Duration
|
**Unit**: `{request}`
|
||||||
|
|
||||||
- **Metric Name**: `infisical.http.server.request.duration`
|
**Description**: Total number of API requests to Infisical (covers both human users and machine identities)
|
||||||
- **Type**: Histogram
|
|
||||||
- **Unit**: `s` (seconds)
|
|
||||||
- **Description**: API request latency
|
|
||||||
- **Buckets**: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]
|
|
||||||
- **Attributes**:
|
|
||||||
- `infisical.organization.id` (string): Organization ID
|
|
||||||
- `infisical.organization.name` (string): Organization name
|
|
||||||
- `infisical.user.id` (string, optional): User ID if human user
|
|
||||||
- `infisical.user.email` (string, optional): User email
|
|
||||||
- `infisical.identity.id` (string, optional): Machine identity ID
|
|
||||||
- `infisical.identity.name` (string, optional): Machine identity name
|
|
||||||
- `http.request.method` (string): HTTP method
|
|
||||||
- `http.route` (string): API endpoint route pattern
|
|
||||||
- `http.response.status_code` (int): HTTP status code
|
|
||||||
- `infisical.project.id` (string, optional): Project ID
|
|
||||||
- `infisical.project.name` (string, optional): Project name
|
|
||||||
|
|
||||||
#### API Errors by Actor
|
**Attributes**:
|
||||||
|
- `infisical.organization.id` (string): Organization ID
|
||||||
|
- `infisical.organization.name` (string): Organization name (e.g., "Platform Engineering Team")
|
||||||
|
- `infisical.user.id` (string, optional): User ID if human user
|
||||||
|
- `infisical.user.email` (string, optional): User email (e.g., "[email protected]")
|
||||||
|
- `infisical.identity.id` (string, optional): Machine identity ID
|
||||||
|
- `infisical.identity.name` (string, optional): Machine identity name (e.g., "prod-k8s-operator")
|
||||||
|
- `infisical.auth.method` (string, optional): Auth method used
|
||||||
|
- `http.request.method` (string): HTTP method (GET, POST, PUT, DELETE)
|
||||||
|
- `http.route` (string): API endpoint route pattern
|
||||||
|
- `http.response.status_code` (int): HTTP status code
|
||||||
|
- `infisical.project.id` (string, optional): Project ID
|
||||||
|
- `infisical.project.name` (string, optional): Project name
|
||||||
|
- `user_agent.original` (string, optional): User agent string
|
||||||
|
- `client.address` (string, optional): IP address
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
- **Metric Name**: `infisical.http.server.error.count`
|
<Accordion title="Request Duration">
|
||||||
- **Type**: Counter
|
**Metric Name**: `infisical.http.server.request.duration`
|
||||||
- **Unit**: `{error}`
|
|
||||||
- **Description**: API errors grouped by actor (for identifying misconfigured services)
|
**Type**: Histogram
|
||||||
- **Attributes**:
|
|
||||||
- `infisical.organization.id` (string): Organization ID
|
**Unit**: `s` (seconds)
|
||||||
- `infisical.organization.name` (string): Organization name
|
|
||||||
- `infisical.user.id` (string, optional): User ID if human
|
**Description**: API request latency
|
||||||
- `infisical.user.email` (string, optional): User email
|
|
||||||
- `infisical.identity.id` (string, optional): Identity ID if machine
|
**Buckets**: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]
|
||||||
- `infisical.identity.name` (string, optional): Identity name
|
|
||||||
- `http.route` (string): API endpoint where error occurred
|
**Attributes**:
|
||||||
- `http.request.method` (string): HTTP method
|
- `infisical.organization.id` (string): Organization ID
|
||||||
- `error.type` (string): Error category/type (client_error, server_error, auth_error, rate_limit_error, etc.)
|
- `infisical.organization.name` (string): Organization name
|
||||||
- `infisical.project.id` (string, optional): Project ID
|
- `infisical.user.id` (string, optional): User ID if human user
|
||||||
- `infisical.project.name` (string, optional): Project name
|
- `infisical.user.email` (string, optional): User email
|
||||||
- `client.address` (string, optional): IP address
|
- `infisical.identity.id` (string, optional): Machine identity ID
|
||||||
- `user_agent.original` (string, optional): User agent information
|
- `infisical.identity.name` (string, optional): Machine identity name
|
||||||
|
- `http.request.method` (string): HTTP method
|
||||||
|
- `http.route` (string): API endpoint route pattern
|
||||||
|
- `http.response.status_code` (int): HTTP status code
|
||||||
|
- `infisical.project.id` (string, optional): Project ID
|
||||||
|
- `infisical.project.name` (string, optional): Project name
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<Accordion title="API Errors by Actor">
|
||||||
|
**Metric Name**: `infisical.http.server.error.count`
|
||||||
|
|
||||||
|
**Type**: Counter
|
||||||
|
|
||||||
|
**Unit**: `{error}`
|
||||||
|
|
||||||
|
**Description**: API errors grouped by actor (for identifying misconfigured services)
|
||||||
|
|
||||||
|
**Attributes**:
|
||||||
|
- `infisical.organization.id` (string): Organization ID
|
||||||
|
- `infisical.organization.name` (string): Organization name
|
||||||
|
- `infisical.user.id` (string, optional): User ID if human
|
||||||
|
- `infisical.user.email` (string, optional): User email
|
||||||
|
- `infisical.identity.id` (string, optional): Identity ID if machine
|
||||||
|
- `infisical.identity.name` (string, optional): Identity name
|
||||||
|
- `http.route` (string): API endpoint where error occurred
|
||||||
|
- `http.request.method` (string): HTTP method
|
||||||
|
- `error.type` (string): Error category/type (client_error, server_error, auth_error, rate_limit_error, etc.)
|
||||||
|
- `infisical.project.id` (string, optional): Project ID
|
||||||
|
- `infisical.project.name` (string, optional): Project name
|
||||||
|
- `client.address` (string, optional): IP address
|
||||||
|
- `user_agent.original` (string, optional): User agent information
|
||||||
|
</Accordion>
|
||||||
|
</AccordionGroup>
|
||||||
|
|
||||||
### Secret Operations Metrics
|
### Secret Operations Metrics
|
||||||
|
|
||||||
These metrics provide visibility into secret access patterns, helping you understand which secrets are being accessed, by whom, and from where. Essential for security auditing and access pattern analysis.
|
These metrics provide visibility into secret access patterns, helping you understand which secrets are being accessed, by whom, and from where. Essential for security auditing and access pattern analysis.
|
||||||
|
|
||||||
#### Secret Read Operations
|
<AccordionGroup>
|
||||||
|
<Accordion title="Secret Read Operations">
|
||||||
- **Metric Name**: `infisical.secret.read.count`
|
**Metric Name**: `infisical.secret.read.count`
|
||||||
- **Type**: Counter
|
|
||||||
- **Unit**: `{operation}`
|
**Type**: Counter
|
||||||
- **Description**: Number of secret read operations
|
|
||||||
- **Attributes**:
|
**Unit**: `{operation}`
|
||||||
- `infisical.organization.id` (string): Organization ID
|
|
||||||
- `infisical.organization.name` (string): Organization name
|
**Description**: Number of secret read operations
|
||||||
- `infisical.project.id` (string): Project ID
|
|
||||||
- `infisical.project.name` (string): Project name (e.g., "payment-service-secrets")
|
**Attributes**:
|
||||||
- `infisical.environment` (string): Environment (dev, staging, prod)
|
- `infisical.organization.id` (string): Organization ID
|
||||||
- `infisical.secret.path` (string): Path to secrets (e.g., "/microservice-a/database")
|
- `infisical.organization.name` (string): Organization name
|
||||||
- `infisical.secret.name` (string, optional): Name of secret
|
- `infisical.project.id` (string): Project ID
|
||||||
- `infisical.user.id` (string, optional): User ID if human
|
- `infisical.project.name` (string): Project name (e.g., "payment-service-secrets")
|
||||||
- `infisical.user.email` (string, optional): User email
|
- `infisical.environment` (string): Environment (dev, staging, prod)
|
||||||
- `infisical.identity.id` (string, optional): Machine identity ID
|
- `infisical.secret.path` (string): Path to secrets (e.g., "/microservice-a/database")
|
||||||
- `infisical.identity.name` (string, optional): Machine identity name
|
- `infisical.secret.name` (string, optional): Name of secret
|
||||||
- `user_agent.original` (string, optional): User agent/SDK information
|
- `infisical.user.id` (string, optional): User ID if human
|
||||||
- `client.address` (string, optional): IP address
|
- `infisical.user.email` (string, optional): User email
|
||||||
|
- `infisical.identity.id` (string, optional): Machine identity ID
|
||||||
|
- `infisical.identity.name` (string, optional): Machine identity name
|
||||||
|
- `user_agent.original` (string, optional): User agent/SDK information
|
||||||
|
- `client.address` (string, optional): IP address
|
||||||
|
</Accordion>
|
||||||
|
</AccordionGroup>
|
||||||
|
|
||||||
### Authentication Metrics
|
### Authentication Metrics
|
||||||
|
|
||||||
These metrics track authentication attempts and outcomes, enabling you to monitor login success rates, detect potential security threats, and identify authentication issues.
|
These metrics track authentication attempts and outcomes, enabling you to monitor login success rates, detect potential security threats, and identify authentication issues.
|
||||||
|
|
||||||
#### Login Attempts
|
<AccordionGroup>
|
||||||
|
<Accordion title="Login Attempts">
|
||||||
- **Metric Name**: `infisical.auth.attempt.count`
|
**Metric Name**: `infisical.auth.attempt.count`
|
||||||
- **Type**: Counter
|
|
||||||
- **Unit**: `{attempt}`
|
**Type**: Counter
|
||||||
- **Description**: Authentication attempts (both successful and failed)
|
|
||||||
- **Attributes**:
|
**Unit**: `{attempt}`
|
||||||
- `infisical.organization.id` (string): Organization ID
|
|
||||||
- `infisical.organization.name` (string): Organization name
|
**Description**: Authentication attempts (both successful and failed)
|
||||||
- `infisical.user.id` (string, optional): User ID if human (if identifiable)
|
|
||||||
- `infisical.user.email` (string, optional): User email (if identifiable)
|
**Attributes**:
|
||||||
- `infisical.identity.id` (string, optional): Identity ID if machine (if identifiable)
|
- `infisical.organization.id` (string): Organization ID
|
||||||
- `infisical.identity.name` (string, optional): Identity name (if identifiable)
|
- `infisical.organization.name` (string): Organization name
|
||||||
- `infisical.auth.method` (string): Authentication method attempted
|
- `infisical.user.id` (string, optional): User ID if human (if identifiable)
|
||||||
- `infisical.auth.result` (string): success or failure
|
- `infisical.user.email` (string, optional): User email (if identifiable)
|
||||||
- `error.type` (string, optional): Reason for failure if failed (invalid_credentials, expired_token, invalid_token, etc.)
|
- `infisical.identity.id` (string, optional): Identity ID if machine (if identifiable)
|
||||||
- `client.address` (string): IP address
|
- `infisical.identity.name` (string, optional): Identity name (if identifiable)
|
||||||
- `user_agent.original` (string, optional): User agent/client information
|
- `infisical.auth.method` (string): Authentication method attempted
|
||||||
- `infisical.auth.attempt.username` (string, optional): Attempted username/email (if available)
|
- `infisical.auth.result` (string): success or failure
|
||||||
|
- `error.type` (string, optional): Reason for failure if failed (invalid_credentials, expired_token, invalid_token, etc.)
|
||||||
### Legacy Metrics
|
- `client.address` (string): IP address
|
||||||
|
- `user_agent.original` (string, optional): User agent/client information
|
||||||
These metrics are from the previous instrumentation and may be deprecated in future versions. Consider migrating to the new Core API Metrics for more comprehensive observability.
|
- `infisical.auth.attempt.username` (string, optional): Attempted username/email (if available)
|
||||||
|
</Accordion>
|
||||||
- `API_latency` - API request latency histogram in milliseconds (Labels: `route`, `method`, `statusCode`)
|
</AccordionGroup>
|
||||||
- `API_errors` - API error count histogram (Labels: `route`, `method`, `type`, `name`)
|
|
||||||
|
|
||||||
### Integration & Secret Sync Metrics
|
### Integration & Secret Sync Metrics
|
||||||
|
|
||||||
These metrics monitor secret synchronization operations between Infisical and external systems, helping you track sync health, identify integration failures, and troubleshoot connectivity issues.
|
These metrics monitor secret synchronization operations between Infisical and external systems, helping you track sync health, identify integration failures, and troubleshoot connectivity issues.
|
||||||
|
|
||||||
- `integration_secret_sync_errors` - Integration secret sync error count
|
<AccordionGroup>
|
||||||
|
<Accordion title="integration_secret_sync_errors">
|
||||||
|
Integration secret sync error count
|
||||||
|
|
||||||
- **Labels**: `version`, `integration`, `integrationId`, `type`, `status`, `name`, `projectId`
|
- **Labels**: `version`, `integration`, `integrationId`, `type`, `status`, `name`, `projectId`
|
||||||
- **Example**: Monitor integration sync failures across different services
|
- **Example**: Monitor integration sync failures across different services
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
- `secret_sync_sync_secrets_errors` - Secret sync operation error count
|
<Accordion title="secret_sync_sync_secrets_errors">
|
||||||
|
Secret sync operation error count
|
||||||
|
|
||||||
- **Labels**: `version`, `destination`, `syncId`, `projectId`, `type`, `status`, `name`
|
- **Labels**: `version`, `destination`, `syncId`, `projectId`, `type`, `status`, `name`
|
||||||
- **Example**: Track secret sync failures to external systems
|
- **Example**: Track secret sync failures to external systems
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
- `secret_sync_import_secrets_errors` - Secret import operation error count
|
<Accordion title="secret_sync_import_secrets_errors">
|
||||||
|
Secret import operation error count
|
||||||
|
|
||||||
- **Labels**: `version`, `destination`, `syncId`, `projectId`, `type`, `status`, `name`
|
- **Labels**: `version`, `destination`, `syncId`, `projectId`, `type`, `status`, `name`
|
||||||
- **Example**: Monitor secret import failures
|
- **Example**: Monitor secret import failures
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
- `secret_sync_remove_secrets_errors` - Secret removal operation error count
|
<Accordion title="secret_sync_remove_secrets_errors">
|
||||||
- **Labels**: `version`, `destination`, `syncId`, `projectId`, `type`, `status`, `name`
|
Secret removal operation error count
|
||||||
- **Example**: Track secret removal operation failures
|
|
||||||
|
- **Labels**: `version`, `destination`, `syncId`, `projectId`, `type`, `status`, `name`
|
||||||
|
- **Example**: Track secret removal operation failures
|
||||||
|
</Accordion>
|
||||||
|
</AccordionGroup>
|
||||||
|
|
||||||
### System Metrics
|
### System Metrics
|
||||||
|
|
||||||
These low-level HTTP metrics are automatically collected by OpenTelemetry's instrumentation layer, providing baseline performance data for all HTTP traffic.
|
These low-level HTTP metrics are automatically collected by OpenTelemetry's instrumentation layer, providing baseline performance data for all HTTP traffic.
|
||||||
|
|
||||||
- `http_server_duration` - HTTP server request duration metrics (histogram buckets, count, sum)
|
<AccordionGroup>
|
||||||
- `http_client_duration` - HTTP client request duration metrics (histogram buckets, count, sum)
|
<Accordion title="http_server_duration">
|
||||||
|
HTTP server request duration metrics (histogram buckets, count, sum)
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<Accordion title="http_client_duration">
|
||||||
|
HTTP client request duration metrics (histogram buckets, count, sum)
|
||||||
|
</Accordion>
|
||||||
|
</AccordionGroup>
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### Common Issues
|
<Accordion title="Metrics not appearing">
|
||||||
|
If your metrics are not showing up in Prometheus or your monitoring system, check the following:
|
||||||
|
|
||||||
1. **Metrics not appearing**:
|
- Verify `OTEL_TELEMETRY_COLLECTION_ENABLED=true` is set in your Infisical environment variables
|
||||||
|
- Ensure the correct `OTEL_EXPORT_TYPE` is set (`prometheus` or `otlp`)
|
||||||
|
- Check network connectivity between Infisical and your monitoring services (Prometheus or OTLP collector)
|
||||||
|
- For pull-based monitoring: Verify port 9464 is exposed and accessible
|
||||||
|
- For push-based monitoring: Verify the OTLP endpoint URL is correct and reachable
|
||||||
|
- Check Infisical backend logs for any errors related to metrics export
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
- Check if `OTEL_TELEMETRY_COLLECTION_ENABLED=true`
|
<Accordion title="Authentication errors">
|
||||||
- Verify the correct `OTEL_EXPORT_TYPE` is set
|
If you're experiencing authentication errors with the OpenTelemetry Collector:
|
||||||
- Check network connectivity between services
|
|
||||||
|
|
||||||
2. **Authentication errors**:
|
- Verify basic auth credentials in your OTLP configuration match between Infisical and the collector
|
||||||
|
- Check that `OTEL_COLLECTOR_BASIC_AUTH_USERNAME` and `OTEL_COLLECTOR_BASIC_AUTH_PASSWORD` match the credentials in your `otel-collector-config.yaml`
|
||||||
- Verify basic auth credentials in OTLP configuration
|
- Ensure the htpasswd format in the collector configuration is correct
|
||||||
- Check if credentials match between Infisical and collector
|
- Test the collector endpoint manually using curl with the same credentials to verify they work
|
||||||
|
</Accordion>
|
||||||
|
|||||||
@@ -35,23 +35,16 @@ export const WishForm = () => {
|
|||||||
const [isOpen, setIsOpen] = useToggle(false);
|
const [isOpen, setIsOpen] = useToggle(false);
|
||||||
|
|
||||||
const createWish = async (data: TFormData) => {
|
const createWish = async (data: TFormData) => {
|
||||||
try {
|
await mutateAsync({
|
||||||
await mutateAsync({
|
text: data.text
|
||||||
text: data.text
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Your wish has been sent to the Infisical team!",
|
text: "Your wish has been sent to the Infisical team!",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
setIsOpen.off();
|
setIsOpen.off();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "An error occured while sending your wish to the Infisical team.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -25,27 +25,20 @@ const TotpRegistration = ({ onComplete, shouldCenterQr }: Props) => {
|
|||||||
|
|
||||||
const handleTotpVerify = async (event: React.FormEvent<HTMLFormElement>) => {
|
const handleTotpVerify = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
try {
|
const result = await verifyUserTotp({
|
||||||
const result = await verifyUserTotp({
|
totp
|
||||||
totp
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully configured mobile authenticator",
|
text: "Successfully configured mobile authenticator",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.recoveryCodes && result.recoveryCodes.length > 0) {
|
if (result.recoveryCodes && result.recoveryCodes.length > 0) {
|
||||||
setRecoveryCodes(result.recoveryCodes);
|
setRecoveryCodes(result.recoveryCodes);
|
||||||
setShowRecoveryModal(true);
|
setShowRecoveryModal(true);
|
||||||
} else if (onComplete) {
|
} else if (onComplete) {
|
||||||
onComplete();
|
onComplete();
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to verify TOTP code",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,35 +43,27 @@ export const CreateOrgModal: FC<CreateOrgModalProps> = ({ isOpen, onClose }) =>
|
|||||||
const { mutateAsync: selectOrg } = useSelectOrganization();
|
const { mutateAsync: selectOrg } = useSelectOrganization();
|
||||||
|
|
||||||
const onFormSubmit = async ({ name }: FormData) => {
|
const onFormSubmit = async ({ name }: FormData) => {
|
||||||
try {
|
const organization = await createOrg({
|
||||||
const organization = await createOrg({
|
name
|
||||||
name
|
});
|
||||||
});
|
|
||||||
|
|
||||||
await selectOrg({
|
await selectOrg({
|
||||||
organizationId: organization.id
|
organizationId: organization.id
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully created organization",
|
text: "Successfully created organization",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
navigate({
|
navigate({
|
||||||
to: "/organization/projects"
|
to: "/organization/projects"
|
||||||
});
|
});
|
||||||
|
|
||||||
localStorage.setItem("orgData.id", organization.id);
|
localStorage.setItem("orgData.id", organization.id);
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
onClose();
|
onClose();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to created organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -20,28 +20,19 @@ export const DeletePkiSyncModal = ({ isOpen, onOpenChange, pkiSync, onComplete }
|
|||||||
const handleDeletePkiSync = async () => {
|
const handleDeletePkiSync = async () => {
|
||||||
const destinationName = PKI_SYNC_MAP[destination].name;
|
const destinationName = PKI_SYNC_MAP[destination].name;
|
||||||
|
|
||||||
try {
|
await deleteSync.mutateAsync({
|
||||||
await deleteSync.mutateAsync({
|
syncId,
|
||||||
syncId,
|
projectId,
|
||||||
projectId,
|
destination
|
||||||
destination
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully deleted ${destinationName} PKI Sync`,
|
text: `Successfully deleted ${destinationName} PKI Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (onComplete) onComplete();
|
if (onComplete) onComplete();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to delete ${destinationName} PKI Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,27 +21,18 @@ const Content = ({ pkiSync, onComplete }: ContentProps) => {
|
|||||||
const triggerImportCertificates = useTriggerPkiSyncImportCertificates();
|
const triggerImportCertificates = useTriggerPkiSyncImportCertificates();
|
||||||
|
|
||||||
const handleTriggerImportCertificates = async () => {
|
const handleTriggerImportCertificates = async () => {
|
||||||
try {
|
await triggerImportCertificates.mutateAsync({
|
||||||
await triggerImportCertificates.mutateAsync({
|
syncId,
|
||||||
syncId,
|
destination,
|
||||||
destination,
|
projectId
|
||||||
projectId
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully triggered certificate import for ${destinationName} Sync`,
|
text: `Successfully triggered certificate import for ${destinationName} Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to trigger certificate import for ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,27 +21,18 @@ const Content = ({ pkiSync, onComplete }: ContentProps) => {
|
|||||||
const triggerRemoveCertificates = useTriggerPkiSyncRemoveCertificates();
|
const triggerRemoveCertificates = useTriggerPkiSyncRemoveCertificates();
|
||||||
|
|
||||||
const handleTriggerRemoveCertificates = async () => {
|
const handleTriggerRemoveCertificates = async () => {
|
||||||
try {
|
await triggerRemoveCertificates.mutateAsync({
|
||||||
await triggerRemoveCertificates.mutateAsync({
|
syncId,
|
||||||
syncId,
|
destination,
|
||||||
destination,
|
projectId
|
||||||
projectId
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully triggered certificate removal for ${destinationName} Sync`,
|
text: `Successfully triggered certificate removal for ${destinationName} Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to trigger certificate removal for ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -86,14 +86,8 @@ export const CreatePkiSyncForm = ({ destination, onComplete, onCancel, initialDa
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(pkiSync);
|
onComplete(pkiSync);
|
||||||
} catch (err: Error | unknown) {
|
} catch {
|
||||||
console.error("PKI sync creation failed:", err);
|
|
||||||
setShowConfirmation(false);
|
setShowConfirmation(false);
|
||||||
createNotification({
|
|
||||||
title: `Failed to create ${destinationName} Certificate Sync`,
|
|
||||||
text: err instanceof Error ? err.message : "An unknown error occurred",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -42,28 +42,19 @@ export const EditPkiSyncForm = ({ pkiSync, fields, onComplete }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit = async ({ connection, ...formData }: TUpdatePkiSyncForm) => {
|
const onSubmit = async ({ connection, ...formData }: TUpdatePkiSyncForm) => {
|
||||||
try {
|
const updatedPkiSync = await updatePkiSync.mutateAsync({
|
||||||
const updatedPkiSync = await updatePkiSync.mutateAsync({
|
syncId: pkiSync.id,
|
||||||
syncId: pkiSync.id,
|
...formData,
|
||||||
...formData,
|
connectionId: connection.id,
|
||||||
connectionId: connection.id,
|
projectId: pkiSync.projectId,
|
||||||
projectId: pkiSync.projectId,
|
destination: pkiSync.destination
|
||||||
destination: pkiSync.destination
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully updated ${destinationName} PKI Sync`,
|
text: `Successfully updated ${destinationName} PKI Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(updatedPkiSync);
|
onComplete(updatedPkiSync);
|
||||||
} catch (err: any) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to update ${destinationName} PKI Sync`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let Component: ReactNode;
|
let Component: ReactNode;
|
||||||
|
|||||||
+2
-2
@@ -71,7 +71,7 @@ export const PkiSyncOptionsFields = ({ destination }: Props) => {
|
|||||||
isChecked={value}
|
isChecked={value}
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
Enable Removal of Active/Revoked Certificates{" "}
|
Enable Removal of Expired/Revoked Certificates{" "}
|
||||||
<Tooltip
|
<Tooltip
|
||||||
className="max-w-md"
|
className="max-w-md"
|
||||||
content={
|
content={
|
||||||
@@ -152,7 +152,7 @@ export const PkiSyncOptionsFields = ({ destination }: Props) => {
|
|||||||
isChecked={value}
|
isChecked={value}
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
Preserve Version on Renewal{" "}
|
Enable Versioning on Renewal{" "}
|
||||||
<Tooltip
|
<Tooltip
|
||||||
className="max-w-md"
|
className="max-w-md"
|
||||||
content={
|
content={
|
||||||
|
|||||||
@@ -56,30 +56,22 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) =
|
|||||||
}, [currentProject, showSlugField]);
|
}, [currentProject, showSlugField]);
|
||||||
|
|
||||||
const onFormSubmit = async (data: BaseFormData | FormDataWithSlug) => {
|
const onFormSubmit = async (data: BaseFormData | FormDataWithSlug) => {
|
||||||
try {
|
if (!currentProject?.id) return;
|
||||||
if (!currentProject?.id) return;
|
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
projectId: currentProject.id,
|
projectId: currentProject.id,
|
||||||
newProjectName: data.name,
|
newProjectName: data.name,
|
||||||
newProjectDescription: data.description,
|
newProjectDescription: data.description,
|
||||||
...(showSlugField &&
|
...(showSlugField &&
|
||||||
"slug" in data && {
|
"slug" in data && {
|
||||||
newSlug: data.slug !== currentProject.slug ? data.slug : undefined
|
newSlug: data.slug !== currentProject.slug ? data.slug : undefined
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully updated project overview",
|
text: "Successfully updated project overview",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update project overview",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -141,29 +141,24 @@ const NewProjectForm = ({ onOpenChange }: NewProjectFormProps) => {
|
|||||||
// type check
|
// type check
|
||||||
if (!currentOrg) return;
|
if (!currentOrg) return;
|
||||||
if (!user) return;
|
if (!user) return;
|
||||||
try {
|
const {
|
||||||
const {
|
data: { project }
|
||||||
data: { project }
|
} = await createWs.mutateAsync({
|
||||||
} = await createWs.mutateAsync({
|
projectName: name,
|
||||||
projectName: name,
|
projectDescription: description,
|
||||||
projectDescription: description,
|
kmsKeyId: kmsKeyId !== INTERNAL_KMS_KEY_ID ? kmsKeyId : undefined,
|
||||||
kmsKeyId: kmsKeyId !== INTERNAL_KMS_KEY_ID ? kmsKeyId : undefined,
|
template,
|
||||||
template,
|
type
|
||||||
type
|
});
|
||||||
});
|
await refetchWorkspaces();
|
||||||
await refetchWorkspaces();
|
|
||||||
|
|
||||||
createNotification({ text: "Project created", type: "success" });
|
createNotification({ text: "Project created", type: "success" });
|
||||||
reset();
|
reset();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
navigate({
|
navigate({
|
||||||
to: getProjectHomePage(project.type, project.environments),
|
to: getProjectHomePage(project.type, project.environments),
|
||||||
params: { projectId: project.id }
|
params: { projectId: project.id }
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({ text: "Failed to create project", type: "error" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const onSubmit = handleSubmit((data) => {
|
const onSubmit = handleSubmit((data) => {
|
||||||
return onCreateProject(data);
|
return onCreateProject(data);
|
||||||
|
|||||||
@@ -37,29 +37,22 @@ export const DeleteSecretRotationV2Modal = ({
|
|||||||
const handleDeleteSecretRotation = async () => {
|
const handleDeleteSecretRotation = async () => {
|
||||||
const rotationType = SECRET_ROTATION_MAP[type].name;
|
const rotationType = SECRET_ROTATION_MAP[type].name;
|
||||||
|
|
||||||
try {
|
await deleteSecretRotation.mutateAsync({
|
||||||
await deleteSecretRotation.mutateAsync({
|
rotationId,
|
||||||
rotationId,
|
type,
|
||||||
type,
|
revokeGeneratedCredentials,
|
||||||
revokeGeneratedCredentials,
|
deleteSecrets,
|
||||||
deleteSecrets,
|
projectId,
|
||||||
projectId,
|
secretPath: folder.path
|
||||||
secretPath: folder.path
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully deleted ${rotationType} Rotation`,
|
text: `Successfully deleted ${rotationType} Rotation`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (onComplete) onComplete();
|
if (onComplete) onComplete();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to delete ${rotationType} Rotation`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -22,28 +22,19 @@ const Content = ({ secretRotation, onComplete }: ContentProps) => {
|
|||||||
const rotationType = SECRET_ROTATION_MAP[type].name;
|
const rotationType = SECRET_ROTATION_MAP[type].name;
|
||||||
|
|
||||||
const handleRotateSecrets = async () => {
|
const handleRotateSecrets = async () => {
|
||||||
try {
|
await rotateSecrets.mutateAsync({
|
||||||
await rotateSecrets.mutateAsync({
|
rotationId,
|
||||||
rotationId,
|
type,
|
||||||
type,
|
projectId,
|
||||||
projectId,
|
secretPath: folder.path
|
||||||
secretPath: folder.path
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully rotated ${rotationType} secrets`,
|
text: `Successfully rotated ${rotationType} secrets`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to rotate ${rotationType} secrets`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -120,21 +120,13 @@ export const SecretRotationV2Form = ({
|
|||||||
environment: environment.slug,
|
environment: environment.slug,
|
||||||
projectId: currentProject.id
|
projectId: currentProject.id
|
||||||
});
|
});
|
||||||
try {
|
const rotation = await mutation;
|
||||||
const rotation = await mutation;
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully ${secretRotation ? "updated" : "created"} ${rotationType} Rotation`,
|
text: `Successfully ${secretRotation ? "updated" : "created"} ${rotationType} Rotation`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(rotation);
|
onComplete(rotation);
|
||||||
} catch (err: any) {
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${secretRotation ? "update" : "create"} ${rotationType} Rotation`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePrev = () => {
|
const handlePrev = () => {
|
||||||
|
|||||||
@@ -28,26 +28,19 @@ export const DeleteSecretScanningDataSourceModal = ({
|
|||||||
const handleDeleteDataSource = async () => {
|
const handleDeleteDataSource = async () => {
|
||||||
const dataSourceType = SECRET_SCANNING_DATA_SOURCE_MAP[type].name;
|
const dataSourceType = SECRET_SCANNING_DATA_SOURCE_MAP[type].name;
|
||||||
|
|
||||||
try {
|
await deleteDataSource.mutateAsync({
|
||||||
await deleteDataSource.mutateAsync({
|
dataSourceId,
|
||||||
dataSourceId,
|
type,
|
||||||
type,
|
projectId
|
||||||
projectId
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully deleted ${dataSourceType} Data Source`,
|
text: `Successfully deleted ${dataSourceType} Data Source`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (onComplete) onComplete();
|
if (onComplete) onComplete();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to delete ${dataSourceType} Data Source`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -73,21 +73,13 @@ export const SecretScanningDataSourceForm = ({
|
|||||||
connectionId: connection?.id,
|
connectionId: connection?.id,
|
||||||
projectId: currentProject.id
|
projectId: currentProject.id
|
||||||
});
|
});
|
||||||
try {
|
const source = await mutation;
|
||||||
const source = await mutation;
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully ${source ? "updated" : "created"} ${sourceType} Data Source`,
|
text: `Successfully ${source ? "updated" : "created"} ${sourceType} Data Source`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(source);
|
onComplete(source);
|
||||||
} catch (err: any) {
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to ${dataSource ? "update" : "create"} ${sourceType} Data Source`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePrev = () => {
|
const handlePrev = () => {
|
||||||
|
|||||||
@@ -23,29 +23,20 @@ export const DeleteSecretSyncModal = ({ isOpen, onOpenChange, secretSync, onComp
|
|||||||
const handleDeleteSecretSync = async () => {
|
const handleDeleteSecretSync = async () => {
|
||||||
const destinationName = SECRET_SYNC_MAP[destination].name;
|
const destinationName = SECRET_SYNC_MAP[destination].name;
|
||||||
|
|
||||||
try {
|
await deleteSync.mutateAsync({
|
||||||
await deleteSync.mutateAsync({
|
syncId,
|
||||||
syncId,
|
destination,
|
||||||
destination,
|
removeSecrets,
|
||||||
removeSecrets,
|
projectId
|
||||||
projectId
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully removed ${destinationName} Sync`,
|
text: `Successfully removed ${destinationName} Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (onComplete) onComplete();
|
if (onComplete) onComplete();
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to remove ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -51,28 +51,19 @@ const Content = ({ secretSync, onComplete }: ContentProps) => {
|
|||||||
const triggerImportSecrets = useTriggerSecretSyncImportSecrets();
|
const triggerImportSecrets = useTriggerSecretSyncImportSecrets();
|
||||||
|
|
||||||
const handleTriggerImportSecrets = async ({ importBehavior }: TFormData) => {
|
const handleTriggerImportSecrets = async ({ importBehavior }: TFormData) => {
|
||||||
try {
|
await triggerImportSecrets.mutateAsync({
|
||||||
await triggerImportSecrets.mutateAsync({
|
syncId,
|
||||||
syncId,
|
destination,
|
||||||
destination,
|
importBehavior,
|
||||||
importBehavior,
|
projectId
|
||||||
projectId
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully triggered secret import for ${destinationName} Sync`,
|
text: `Successfully triggered secret import for ${destinationName} Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to trigger secret import for ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,27 +21,18 @@ const Content = ({ secretSync, onComplete }: ContentProps) => {
|
|||||||
const triggerSyncImport = useTriggerSecretSyncRemoveSecrets();
|
const triggerSyncImport = useTriggerSecretSyncRemoveSecrets();
|
||||||
|
|
||||||
const handleTriggerRemoveSecrets = async () => {
|
const handleTriggerRemoveSecrets = async () => {
|
||||||
try {
|
await triggerSyncImport.mutateAsync({
|
||||||
await triggerSyncImport.mutateAsync({
|
syncId,
|
||||||
syncId,
|
destination,
|
||||||
destination,
|
projectId
|
||||||
projectId
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully triggered secret removal for ${destinationName} Sync`,
|
text: `Successfully triggered secret removal for ${destinationName} Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
onComplete();
|
onComplete();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to trigger secret removal for ${destinationName} Sync`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -88,14 +88,8 @@ export const CreateSecretSyncForm = ({
|
|||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(secretSync);
|
onComplete(secretSync);
|
||||||
} catch (err: any) {
|
} catch {
|
||||||
console.error(err);
|
|
||||||
setShowConfirmation(false);
|
setShowConfirmation(false);
|
||||||
createNotification({
|
|
||||||
title: `Failed to add ${destinationName} Sync`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -58,29 +58,20 @@ export const EditSecretSyncForm = ({ secretSync, fields, onComplete }: Props) =>
|
|||||||
|
|
||||||
const performUpdate = useCallback(
|
const performUpdate = useCallback(
|
||||||
async (formData: TSecretSyncForm) => {
|
async (formData: TSecretSyncForm) => {
|
||||||
try {
|
const { environment, connection, ...updateData } = formData;
|
||||||
const { environment, connection, ...updateData } = formData;
|
const updatedSecretSync = await updateSecretSync.mutateAsync({
|
||||||
const updatedSecretSync = await updateSecretSync.mutateAsync({
|
syncId: secretSync.id,
|
||||||
syncId: secretSync.id,
|
...updateData,
|
||||||
...updateData,
|
environment: environment?.slug,
|
||||||
environment: environment?.slug,
|
connectionId: connection.id,
|
||||||
connectionId: connection.id,
|
projectId: secretSync.projectId
|
||||||
projectId: secretSync.projectId
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully updated ${destinationName} Sync`,
|
text: `Successfully updated ${destinationName} Sync`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onComplete(updatedSecretSync);
|
onComplete(updatedSecretSync);
|
||||||
} catch (err: any) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
title: `Failed to update ${destinationName} Sync`,
|
|
||||||
text: err.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[updateSecretSync, secretSync.id, secretSync.projectId, destinationName, onComplete]
|
[updateSecretSync, secretSync.id, secretSync.projectId, destinationName, onComplete]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -130,26 +130,18 @@ export const CreateTagModal = ({ isOpen, onToggle, append, currentSecret }: Prop
|
|||||||
}, [isOpen]);
|
}, [isOpen]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ slug, color }: FormData) => {
|
const onFormSubmit = async ({ slug, color }: FormData) => {
|
||||||
try {
|
const data = await createWsTag({
|
||||||
const data = await createWsTag({
|
projectId,
|
||||||
projectId,
|
tagColor: color,
|
||||||
tagColor: color,
|
tagSlug: slug
|
||||||
tagSlug: slug
|
});
|
||||||
});
|
append(data);
|
||||||
append(data);
|
onToggle(false);
|
||||||
onToggle(false);
|
reset();
|
||||||
reset();
|
createNotification({
|
||||||
createNotification({
|
text: "Successfully created a tag",
|
||||||
text: "Successfully created a tag",
|
type: "success"
|
||||||
type: "success"
|
});
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create a tag",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -9,22 +9,10 @@ export const HighlightText = ({
|
|||||||
}) => {
|
}) => {
|
||||||
if (!text) return null;
|
if (!text) return null;
|
||||||
|
|
||||||
const renderTextWithNewlines = (input: string, baseKeyPrefix: string = ""): React.ReactNode[] => {
|
|
||||||
if (!input) return [];
|
|
||||||
const lines = input.split("\n");
|
|
||||||
return lines.flatMap((line, index) => {
|
|
||||||
const nodes: React.ReactNode[] = [line];
|
|
||||||
if (index < lines.length - 1) {
|
|
||||||
nodes.push(<br key={`${baseKeyPrefix}-br-${line}`} />);
|
|
||||||
}
|
|
||||||
return nodes;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const searchTerm = highlight.toLowerCase().trim();
|
const searchTerm = highlight.toLowerCase().trim();
|
||||||
|
|
||||||
if (!searchTerm) {
|
if (!searchTerm) {
|
||||||
return <span>{renderTextWithNewlines(text, "full-text")}</span>;
|
return <span>{text}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parts: React.ReactNode[] = [];
|
const parts: React.ReactNode[] = [];
|
||||||
@@ -36,16 +24,12 @@ export const HighlightText = ({
|
|||||||
text.replace(regex, (match: string, offset: number) => {
|
text.replace(regex, (match: string, offset: number) => {
|
||||||
if (offset > lastIndex) {
|
if (offset > lastIndex) {
|
||||||
const preMatchText = text.substring(lastIndex, offset);
|
const preMatchText = text.substring(lastIndex, offset);
|
||||||
parts.push(
|
parts.push(<span key={`pre-${lastIndex}`}>{preMatchText}</span>);
|
||||||
<span key={`pre-${lastIndex}`}>
|
|
||||||
{renderTextWithNewlines(preMatchText, `pre-${lastIndex}`)}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parts.push(
|
parts.push(
|
||||||
<span key={`match-${offset}`} className={highlightClassName || "bg-yellow/30"}>
|
<span key={`match-${offset}`} className={highlightClassName || "bg-yellow/30"}>
|
||||||
{renderTextWithNewlines(match, `match-${offset}`)}
|
{match}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -56,11 +40,7 @@ export const HighlightText = ({
|
|||||||
|
|
||||||
if (lastIndex < text.length) {
|
if (lastIndex < text.length) {
|
||||||
const postMatchText = text.substring(lastIndex);
|
const postMatchText = text.substring(lastIndex);
|
||||||
parts.push(
|
parts.push(<span key={`post-${lastIndex}`}>{postMatchText}</span>);
|
||||||
<span key={`post-${lastIndex}`}>
|
|
||||||
{renderTextWithNewlines(postMatchText, `post-${lastIndex}`)}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parts;
|
return parts;
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ export const APP_CONNECTION_MAP: Record<
|
|||||||
image: "Laravel Forge.png",
|
image: "Laravel Forge.png",
|
||||||
size: 65
|
size: 65
|
||||||
},
|
},
|
||||||
[AppConnection.Chef]: { name: "Chef", image: "Chef.png" }
|
[AppConnection.Chef]: { name: "Chef", image: "Chef.png", enterprise: true }
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
|
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
|
||||||
|
|||||||
+13
-20
@@ -36,28 +36,21 @@ export const NewSubOrganizationForm = ({ onClose }: ContentProps) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const onSubmit = async ({ name }: FormData) => {
|
const onSubmit = async ({ name }: FormData) => {
|
||||||
try {
|
const { organization } = await createSubOrg.mutateAsync({
|
||||||
const { organization } = await createSubOrg.mutateAsync({
|
name
|
||||||
name
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Successfully created sub organization"
|
text: "Successfully created sub organization"
|
||||||
});
|
});
|
||||||
onClose();
|
onClose();
|
||||||
|
|
||||||
navigate({
|
navigate({
|
||||||
to: "/organization/projects",
|
to: "/organization/projects",
|
||||||
search: (prev) => ({ ...prev, subOrganization: organization.name })
|
search: (prev) => ({ ...prev, subOrganization: organization.name })
|
||||||
});
|
});
|
||||||
await router.invalidate({ sync: true }).catch(() => null);
|
await router.invalidate({ sync: true }).catch(() => null);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create sub organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|||||||
import { Link, linkOptions } from "@tanstack/react-router";
|
import { Link, linkOptions } from "@tanstack/react-router";
|
||||||
|
|
||||||
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
|
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
|
||||||
import { createNotification } from "@app/components/notifications";
|
|
||||||
import { OrgPermissionCan } from "@app/components/permissions";
|
import { OrgPermissionCan } from "@app/components/permissions";
|
||||||
import { NewProjectModal } from "@app/components/projects";
|
import { NewProjectModal } from "@app/components/projects";
|
||||||
import {
|
import {
|
||||||
@@ -59,31 +58,17 @@ export const ProjectSelect = () => {
|
|||||||
const { mutateAsync: updateUserProjectFavorites } = useUpdateUserProjectFavorites();
|
const { mutateAsync: updateUserProjectFavorites } = useUpdateUserProjectFavorites();
|
||||||
|
|
||||||
const addProjectToFavorites = async (projectId: string) => {
|
const addProjectToFavorites = async (projectId: string) => {
|
||||||
try {
|
await updateUserProjectFavorites({
|
||||||
await updateUserProjectFavorites({
|
orgId: currentOrg!.id,
|
||||||
orgId: currentOrg!.id,
|
projectFavorites: [...(projectFavorites || []), projectId]
|
||||||
projectFavorites: [...(projectFavorites || []), projectId]
|
});
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to add project to favorites.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeProjectFromFavorites = async (projectId: string) => {
|
const removeProjectFromFavorites = async (projectId: string) => {
|
||||||
try {
|
await updateUserProjectFavorites({
|
||||||
await updateUserProjectFavorites({
|
orgId: currentOrg!.id,
|
||||||
orgId: currentOrg!.id,
|
projectFavorites: [...(projectFavorites || []).filter((entry) => entry !== projectId)]
|
||||||
projectFavorites: [...(projectFavorites || []).filter((entry) => entry !== projectId)]
|
});
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to remove project from favorites.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAddingProjectsAllowed = subscription?.workspaceLimit
|
const isAddingProjectsAllowed = subscription?.workspaceLimit
|
||||||
|
|||||||
@@ -65,20 +65,13 @@ const Content = ({ onClose }: ContentProps) => {
|
|||||||
const users = usersData.filter((user) => !user.superAdmin);
|
const users = usersData.filter((user) => !user.superAdmin);
|
||||||
|
|
||||||
const onSubmit = async ({ user }: FormData) => {
|
const onSubmit = async ({ user }: FormData) => {
|
||||||
try {
|
await grantAdmin.mutateAsync(user.id);
|
||||||
await grantAdmin.mutateAsync(user.id);
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Successfully granted server admin status"
|
text: "Successfully granted server admin status"
|
||||||
});
|
});
|
||||||
onClose();
|
onClose();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to grant server admin status",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -303,18 +303,11 @@ export const ServerAdminsTable = () => {
|
|||||||
const handleRemoveUser = async () => {
|
const handleRemoveUser = async () => {
|
||||||
const { id } = popUp?.removeUser?.data as { id: string; username: string };
|
const { id } = popUp?.removeUser?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
await deleteUser(id);
|
||||||
await deleteUser(id);
|
createNotification({
|
||||||
createNotification({
|
type: "success",
|
||||||
type: "success",
|
text: "Successfully deleted user"
|
||||||
text: "Successfully deleted user"
|
});
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error deleting user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeUser");
|
handlePopUpClose("removeUser");
|
||||||
};
|
};
|
||||||
@@ -322,39 +315,25 @@ export const ServerAdminsTable = () => {
|
|||||||
const handleRemoveServerAdminAccess = async () => {
|
const handleRemoveServerAdminAccess = async () => {
|
||||||
const { id } = popUp?.removeServerAdmin?.data as { id: string; username: string };
|
const { id } = popUp?.removeServerAdmin?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
await removeAdminAccess(id);
|
||||||
await removeAdminAccess(id);
|
createNotification({
|
||||||
createNotification({
|
type: "success",
|
||||||
type: "success",
|
text: "Successfully removed server admin access from user"
|
||||||
text: "Successfully removed server admin access from user"
|
});
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error removing server admin access from user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeServerAdmin");
|
handlePopUpClose("removeServerAdmin");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRemoveUsers = async () => {
|
const handleRemoveUsers = async () => {
|
||||||
try {
|
await deleteUsers(selectedUsers.map((user) => user.id));
|
||||||
await deleteUsers(selectedUsers.map((user) => user.id));
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully removed users",
|
text: "Successfully removed users",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
setSelectedUsers([]);
|
setSelectedUsers([]);
|
||||||
handlePopUpClose("removeUsers");
|
handlePopUpClose("removeUsers");
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to remove users",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -54,59 +54,51 @@ export const AuthenticationPageForm = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onAuthFormSubmit = async (formData: TAuthForm) => {
|
const onAuthFormSubmit = async (formData: TAuthForm) => {
|
||||||
try {
|
const enabledMethods: LoginMethod[] = [];
|
||||||
const enabledMethods: LoginMethod[] = [];
|
if (formData.isEmailEnabled) {
|
||||||
if (formData.isEmailEnabled) {
|
enabledMethods.push(LoginMethod.EMAIL);
|
||||||
enabledMethods.push(LoginMethod.EMAIL);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (formData.isGoogleEnabled) {
|
if (formData.isGoogleEnabled) {
|
||||||
enabledMethods.push(LoginMethod.GOOGLE);
|
enabledMethods.push(LoginMethod.GOOGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formData.isGithubEnabled) {
|
if (formData.isGithubEnabled) {
|
||||||
enabledMethods.push(LoginMethod.GITHUB);
|
enabledMethods.push(LoginMethod.GITHUB);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formData.isGitlabEnabled) {
|
if (formData.isGitlabEnabled) {
|
||||||
enabledMethods.push(LoginMethod.GITLAB);
|
enabledMethods.push(LoginMethod.GITLAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formData.isSamlEnabled) {
|
if (formData.isSamlEnabled) {
|
||||||
enabledMethods.push(LoginMethod.SAML);
|
enabledMethods.push(LoginMethod.SAML);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formData.isLdapEnabled) {
|
if (formData.isLdapEnabled) {
|
||||||
enabledMethods.push(LoginMethod.LDAP);
|
enabledMethods.push(LoginMethod.LDAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formData.isOidcEnabled) {
|
if (formData.isOidcEnabled) {
|
||||||
enabledMethods.push(LoginMethod.OIDC);
|
enabledMethods.push(LoginMethod.OIDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enabledMethods.length) {
|
if (!enabledMethods.length) {
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "At least one login method should be enabled."
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await updateServerConfig({
|
|
||||||
enabledLoginMethods: enabledMethods
|
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: "Login methods have been successfully updated.",
|
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "error",
|
type: "error",
|
||||||
text: "Failed to update login methods."
|
text: "At least one login method should be enabled."
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await updateServerConfig({
|
||||||
|
enabledLoginMethods: enabledMethods
|
||||||
|
});
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: "Login methods have been successfully updated.",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -31,15 +31,10 @@ export const CachingPageForm = () => {
|
|||||||
const handleInvalidateCacheSubmit = async () => {
|
const handleInvalidateCacheSubmit = async () => {
|
||||||
if (!type || isInvalidating) return;
|
if (!type || isInvalidating) return;
|
||||||
|
|
||||||
try {
|
await invalidateCache({ type });
|
||||||
await invalidateCache({ type });
|
createNotification({ text: `Began invalidating ${type} cache`, type: "success" });
|
||||||
createNotification({ text: `Began invalidating ${type} cache`, type: "success" });
|
setShouldPoll(true);
|
||||||
setShouldPoll(true);
|
handlePopUpClose("invalidateCache");
|
||||||
handlePopUpClose("invalidateCache");
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({ text: `Failed to invalidate ${type} cache`, type: "error" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -60,19 +60,12 @@ export const EncryptionPageForm = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
await updateEncryptionStrategy(formData.encryptionStrategy);
|
||||||
await updateEncryptionStrategy(formData.encryptionStrategy);
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Encryption strategy updated successfully"
|
text: "Encryption strategy updated successfully"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Failed to update encryption strategy"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -176,31 +176,19 @@ export const EnvironmentPageForm = () => {
|
|||||||
|
|
||||||
const onSubmit = useCallback(
|
const onSubmit = useCallback(
|
||||||
async (formData: TForm) => {
|
async (formData: TForm) => {
|
||||||
try {
|
const filteredFormData = Object.fromEntries(
|
||||||
const filteredFormData = Object.fromEntries(
|
Object.entries(formData).filter(([, value]) => value !== "")
|
||||||
Object.entries(formData).filter(([, value]) => value !== "")
|
);
|
||||||
);
|
await updateServerConfig({
|
||||||
await updateServerConfig({
|
envOverrides: filteredFormData
|
||||||
envOverrides: filteredFormData
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Environment overrides updated successfully. It can take up to 5 minutes to take effect."
|
text: "Environment overrides updated successfully. It can take up to 5 minutes to take effect."
|
||||||
});
|
});
|
||||||
|
|
||||||
reset(formData);
|
reset(formData);
|
||||||
} catch (error) {
|
|
||||||
const errorMessage =
|
|
||||||
(error as any)?.response?.data?.message ||
|
|
||||||
(error as any)?.message ||
|
|
||||||
"An unknown error occurred";
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
title: "Failed to update environment overrides",
|
|
||||||
text: errorMessage
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[reset, updateServerConfig]
|
[reset, updateServerConfig]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -68,37 +68,29 @@ export const GeneralPageForm = () => {
|
|||||||
const organizations = useGetOrganizations();
|
const organizations = useGetOrganizations();
|
||||||
|
|
||||||
const onFormSubmit = async (formData: TDashboardForm) => {
|
const onFormSubmit = async (formData: TDashboardForm) => {
|
||||||
try {
|
const {
|
||||||
const {
|
allowedSignUpDomain,
|
||||||
allowedSignUpDomain,
|
trustSamlEmails,
|
||||||
trustSamlEmails,
|
trustLdapEmails,
|
||||||
trustLdapEmails,
|
trustOidcEmails,
|
||||||
trustOidcEmails,
|
authConsentContent,
|
||||||
authConsentContent,
|
pageFrameContent
|
||||||
pageFrameContent
|
} = formData;
|
||||||
} = formData;
|
|
||||||
|
|
||||||
await updateServerConfig({
|
await updateServerConfig({
|
||||||
defaultAuthOrgId: defaultAuthOrgId || null,
|
defaultAuthOrgId: defaultAuthOrgId || null,
|
||||||
allowSignUp: signUpMode !== SignUpModes.Disabled,
|
allowSignUp: signUpMode !== SignUpModes.Disabled,
|
||||||
allowedSignUpDomain: signUpMode === SignUpModes.Anyone ? allowedSignUpDomain : null,
|
allowedSignUpDomain: signUpMode === SignUpModes.Anyone ? allowedSignUpDomain : null,
|
||||||
trustSamlEmails,
|
trustSamlEmails,
|
||||||
trustLdapEmails,
|
trustLdapEmails,
|
||||||
trustOidcEmails,
|
trustOidcEmails,
|
||||||
authConsentContent,
|
authConsentContent,
|
||||||
pageFrameContent
|
pageFrameContent
|
||||||
});
|
});
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully changed sign up setting.",
|
text: "Successfully changed sign up setting.",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Failed to update sign up setting."
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -10,23 +10,15 @@ export const UsageReportSection = () => {
|
|||||||
const generateUsageReport = useGenerateUsageReport();
|
const generateUsageReport = useGenerateUsageReport();
|
||||||
|
|
||||||
const handleGenerateReport = async () => {
|
const handleGenerateReport = async () => {
|
||||||
try {
|
const response = await generateUsageReport.mutateAsync();
|
||||||
const response = await generateUsageReport.mutateAsync();
|
const { csvContent, filename } = response;
|
||||||
const { csvContent, filename } = response;
|
|
||||||
|
|
||||||
downloadFile(csvContent, filename, "text/csv");
|
downloadFile(csvContent, filename, "text/csv");
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Usage report downloaded: "${filename}"`,
|
text: `Usage report downloaded: "${filename}"`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to generate usage report:", error);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to generate usage report. Please try again.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -81,25 +81,18 @@ const Content = ({ onClose }: ContentProps) => {
|
|||||||
const { users = [] } = data ?? {};
|
const { users = [] } = data ?? {};
|
||||||
|
|
||||||
const onSubmit = async ({ name, invitees }: FormData) => {
|
const onSubmit = async ({ name, invitees }: FormData) => {
|
||||||
try {
|
await createOrg.mutateAsync({
|
||||||
await createOrg.mutateAsync({
|
name,
|
||||||
name,
|
inviteAdminEmails: invitees
|
||||||
inviteAdminEmails: invitees
|
.filter((user) => Boolean(user.email))
|
||||||
.filter((user) => Boolean(user.email))
|
.map((user) => user.email) as string[]
|
||||||
.map((user) => user.email) as string[]
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
text: "Successfully created organization"
|
text: "Successfully created organization"
|
||||||
});
|
});
|
||||||
onClose();
|
onClose();
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const { append } = useFieldArray<FormData>({ control, name: "invitees" });
|
const { append } = useFieldArray<FormData>({ control, name: "invitees" });
|
||||||
|
|||||||
+5
-12
@@ -185,18 +185,11 @@ export const MachineIdentitiesTable = () => {
|
|||||||
const handleRemoveServerAdmin = async () => {
|
const handleRemoveServerAdmin = async () => {
|
||||||
const { id } = popUp?.removeServerAdmin?.data as { id: string; name: string };
|
const { id } = popUp?.removeServerAdmin?.data as { id: string; name: string };
|
||||||
|
|
||||||
try {
|
await deleteIdentitySuperAdminAccess(id);
|
||||||
await deleteIdentitySuperAdminAccess(id);
|
createNotification({
|
||||||
createNotification({
|
type: "success",
|
||||||
type: "success",
|
text: "Successfully removed server admin permissions"
|
||||||
text: "Successfully removed server admin permissions"
|
});
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error removing server admin permissions"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeServerAdmin");
|
handlePopUpClose("removeServerAdmin");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -179,12 +179,6 @@ const ViewMembersModalContent = ({
|
|||||||
text: "Successfully resent org invitation",
|
text: "Successfully resent org invitation",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to resend org invitation",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
} finally {
|
} finally {
|
||||||
setResendInviteId(null);
|
setResendInviteId(null);
|
||||||
}
|
}
|
||||||
@@ -479,26 +473,19 @@ const OrganizationsPanelTable = ({
|
|||||||
const { mutateAsync: accessOrganization } = useServerAdminAccessOrg();
|
const { mutateAsync: accessOrganization } = useServerAdminAccessOrg();
|
||||||
|
|
||||||
const handleAccessOrg = async (orgId: string) => {
|
const handleAccessOrg = async (orgId: string) => {
|
||||||
try {
|
await accessOrganization(orgId);
|
||||||
await accessOrganization(orgId);
|
|
||||||
|
|
||||||
navigate({
|
navigate({
|
||||||
to: "/login/select-organization",
|
to: "/login/select-organization",
|
||||||
search: {
|
search: {
|
||||||
org_id: orgId
|
org_id: orgId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully joined organization",
|
text: "Successfully joined organization",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to join organization",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -364,18 +364,11 @@ export const UserIdentitiesTable = () => {
|
|||||||
const handleRemoveUser = async () => {
|
const handleRemoveUser = async () => {
|
||||||
const { id } = popUp?.removeUser?.data as { id: string; username: string };
|
const { id } = popUp?.removeUser?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
await deleteUser(id);
|
||||||
await deleteUser(id);
|
createNotification({
|
||||||
createNotification({
|
type: "success",
|
||||||
type: "success",
|
text: "Successfully deleted user"
|
||||||
text: "Successfully deleted user"
|
});
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error deleting user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeUser");
|
handlePopUpClose("removeUser");
|
||||||
};
|
};
|
||||||
@@ -383,18 +376,11 @@ export const UserIdentitiesTable = () => {
|
|||||||
const handleGrantServerAdminAccess = async () => {
|
const handleGrantServerAdminAccess = async () => {
|
||||||
const { id } = popUp?.upgradeToServerAdmin?.data as { id: string; username: string };
|
const { id } = popUp?.upgradeToServerAdmin?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
await grantAdminAccess(id);
|
||||||
await grantAdminAccess(id);
|
createNotification({
|
||||||
createNotification({
|
type: "success",
|
||||||
type: "success",
|
text: "Successfully granted server admin access to user"
|
||||||
text: "Successfully granted server admin access to user"
|
});
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error granting server admin access to user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("upgradeToServerAdmin");
|
handlePopUpClose("upgradeToServerAdmin");
|
||||||
};
|
};
|
||||||
@@ -402,39 +388,25 @@ export const UserIdentitiesTable = () => {
|
|||||||
const handleRemoveServerAdminAccess = async () => {
|
const handleRemoveServerAdminAccess = async () => {
|
||||||
const { id } = popUp?.removeServerAdmin?.data as { id: string; username: string };
|
const { id } = popUp?.removeServerAdmin?.data as { id: string; username: string };
|
||||||
|
|
||||||
try {
|
await removeAdminAccess(id);
|
||||||
await removeAdminAccess(id);
|
createNotification({
|
||||||
createNotification({
|
type: "success",
|
||||||
type: "success",
|
text: "Successfully removed server admin access from user"
|
||||||
text: "Successfully removed server admin access from user"
|
});
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Error removing server admin access from user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpClose("removeServerAdmin");
|
handlePopUpClose("removeServerAdmin");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRemoveUsers = async () => {
|
const handleRemoveUsers = async () => {
|
||||||
try {
|
await deleteUsers(selectedUsers.map((user) => user.id));
|
||||||
await deleteUsers(selectedUsers.map((user) => user.id));
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully removed users",
|
text: "Successfully removed users",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
setSelectedUsers([]);
|
setSelectedUsers([]);
|
||||||
handlePopUpClose("removeUsers");
|
handlePopUpClose("removeUsers");
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to remove users",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { useNavigate } from "@tanstack/react-router";
|
|||||||
import { AnimatePresence, motion } from "framer-motion";
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { createNotification } from "@app/components/notifications";
|
|
||||||
// TODO(akhilmhdh): rewrite this into module functions in lib
|
// TODO(akhilmhdh): rewrite this into module functions in lib
|
||||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||||
import { Button, ContentLoader, FormControl, Input } from "@app/components/v2";
|
import { Button, ContentLoader, FormControl, Input } from "@app/components/v2";
|
||||||
@@ -46,29 +45,21 @@ export const SignUpPage = () => {
|
|||||||
const handleFormSubmit = async ({ email, password, firstName, lastName }: TFormSchema) => {
|
const handleFormSubmit = async ({ email, password, firstName, lastName }: TFormSchema) => {
|
||||||
// avoid multi submission
|
// avoid multi submission
|
||||||
if (isSubmitting) return;
|
if (isSubmitting) return;
|
||||||
try {
|
const res = await createAdminUser({
|
||||||
const res = await createAdminUser({
|
email,
|
||||||
email,
|
password,
|
||||||
password,
|
firstName,
|
||||||
firstName,
|
lastName
|
||||||
lastName
|
});
|
||||||
});
|
|
||||||
|
|
||||||
SecurityClient.setToken(res.token);
|
SecurityClient.setToken(res.token);
|
||||||
await selectOrganization({ organizationId: res.organization.id });
|
await selectOrganization({ organizationId: res.organization.id });
|
||||||
|
|
||||||
// TODO(akhilmhdh): This is such a confusing pattern and too unreliable
|
// TODO(akhilmhdh): This is such a confusing pattern and too unreliable
|
||||||
// Will be refactored in next iteration to make it url based rather than local storage ones
|
// Will be refactored in next iteration to make it url based rather than local storage ones
|
||||||
// Part of migration to nextjs 14
|
// Part of migration to nextjs 14
|
||||||
localStorage.setItem("orgData.id", res.organization.id);
|
localStorage.setItem("orgData.id", res.organization.id);
|
||||||
navigate({ to: "/admin" });
|
navigate({ to: "/admin" });
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: "Failed to create admin"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (config?.initialized) return <ContentLoader text="Redirecting to admin page..." />;
|
if (config?.initialized) return <ContentLoader text="Redirecting to admin page..." />;
|
||||||
|
|||||||
@@ -75,11 +75,7 @@ export const PasswordSetupPage = () => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = "/login";
|
window.location.href = "/login";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
} catch (error) {
|
} catch {
|
||||||
createNotification({
|
|
||||||
type: "error",
|
|
||||||
text: (error as Error).message ?? "Error setting password"
|
|
||||||
});
|
|
||||||
navigate({ to: "/personal-settings" });
|
navigate({ to: "/personal-settings" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-48
@@ -73,67 +73,53 @@ export const EmailConfirmationStep = ({
|
|||||||
const { mutateAsync: verifyEmailVerificationCode } = useVerifyEmailVerificationCode();
|
const { mutateAsync: verifyEmailVerificationCode } = useVerifyEmailVerificationCode();
|
||||||
|
|
||||||
const checkCode = async () => {
|
const checkCode = async () => {
|
||||||
try {
|
await verifyEmailVerificationCode({ username, code });
|
||||||
await verifyEmailVerificationCode({ username, code });
|
setCodeError(false);
|
||||||
setCodeError(false);
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully verified code",
|
text: "Successfully verified code",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
switch (authType) {
|
switch (authType) {
|
||||||
case UserAliasType.SAML: {
|
case UserAliasType.SAML: {
|
||||||
window.open(`/api/v1/sso/redirect/saml2/organizations/${organizationSlug}`);
|
window.open(`/api/v1/sso/redirect/saml2/organizations/${organizationSlug}`);
|
||||||
window.close();
|
window.close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UserAliasType.LDAP: {
|
case UserAliasType.LDAP: {
|
||||||
navigate({ to: "/login/ldap", search: { organizationSlug } });
|
navigate({ to: "/login/ldap", search: { organizationSlug } });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UserAliasType.OIDC: {
|
case UserAliasType.OIDC: {
|
||||||
window.open(`/api/v1/sso/oidc/login?orgSlug=${organizationSlug}`);
|
window.open(`/api/v1/sso/oidc/login?orgSlug=${organizationSlug}`);
|
||||||
window.close();
|
window.close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
setStep(1);
|
setStep(1);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to verify code",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setCode("");
|
setCode("");
|
||||||
};
|
};
|
||||||
|
|
||||||
const resendCode = async () => {
|
const resendCode = async () => {
|
||||||
try {
|
const queryParams = new URLSearchParams(window.location.search);
|
||||||
const queryParams = new URLSearchParams(window.location.search);
|
const token = queryParams.get("token");
|
||||||
const token = queryParams.get("token");
|
if (!token) {
|
||||||
if (!token) {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to resend code, no token found",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await sendEmailVerificationCode(token);
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully resent code",
|
text: "Failed to resend code, no token found",
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to resend code",
|
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
await sendEmailVerificationCode(token);
|
||||||
|
createNotification({
|
||||||
|
text: "Successfully resent code",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -113,52 +113,44 @@ export const PkiAlertModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
alertUnit,
|
alertUnit,
|
||||||
emails
|
emails
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
if (!projectId) return;
|
||||||
if (!projectId) return;
|
|
||||||
|
|
||||||
const emailArray = emails
|
const emailArray = emails
|
||||||
.split(",")
|
.split(",")
|
||||||
.map((email) => email.trim())
|
.map((email) => email.trim())
|
||||||
.filter((email) => email.length > 0);
|
.filter((email) => email.length > 0);
|
||||||
|
|
||||||
const alertBeforeDays = convertToDays(alertUnit, Number(alertBefore));
|
const alertBeforeDays = convertToDays(alertUnit, Number(alertBefore));
|
||||||
|
|
||||||
if (alert) {
|
if (alert) {
|
||||||
// update
|
// update
|
||||||
await updatePkiAlert({
|
await updatePkiAlert({
|
||||||
alertId: alert.id,
|
alertId: alert.id,
|
||||||
pkiCollectionId,
|
pkiCollectionId,
|
||||||
name,
|
name,
|
||||||
projectId,
|
projectId,
|
||||||
alertBeforeDays,
|
alertBeforeDays,
|
||||||
emails: emailArray
|
emails: emailArray
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// create
|
|
||||||
await createPkiAlert({
|
|
||||||
name,
|
|
||||||
projectId,
|
|
||||||
pkiCollectionId,
|
|
||||||
alertBeforeDays,
|
|
||||||
emails: emailArray
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpToggle("pkiAlert", false);
|
|
||||||
|
|
||||||
reset();
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Successfully ${alert ? "updated" : "created"} alert`,
|
|
||||||
type: "success"
|
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} else {
|
||||||
console.error(err);
|
// create
|
||||||
createNotification({
|
await createPkiAlert({
|
||||||
text: `Failed to ${alert ? "updated" : "created"} alert`,
|
name,
|
||||||
type: "error"
|
projectId,
|
||||||
|
pkiCollectionId,
|
||||||
|
alertBeforeDays,
|
||||||
|
emails: emailArray
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlePopUpToggle("pkiAlert", false);
|
||||||
|
|
||||||
|
reset();
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: `Successfully ${alert ? "updated" : "created"} alert`,
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -22,27 +22,19 @@ export const PkiAlertsSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveAlertSubmit = async (alertId: string) => {
|
const onRemoveAlertSubmit = async (alertId: string) => {
|
||||||
try {
|
if (!projectId) return;
|
||||||
if (!projectId) return;
|
|
||||||
|
|
||||||
await deletePkiAlert({
|
await deletePkiAlert({
|
||||||
alertId,
|
alertId,
|
||||||
projectId
|
projectId
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully deleted alert",
|
text: "Successfully deleted alert",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deletePkiAlert");
|
handlePopUpClose("deletePkiAlert");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete alert",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -62,49 +62,41 @@ export const PkiCollectionModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
}, [pkiCollection]);
|
}, [pkiCollection]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ name, description }: FormData) => {
|
const onFormSubmit = async ({ name, description }: FormData) => {
|
||||||
try {
|
if (!projectId) return;
|
||||||
if (!projectId) return;
|
|
||||||
|
|
||||||
if (pkiCollection) {
|
if (pkiCollection) {
|
||||||
// update
|
// update
|
||||||
await updatePkiCollection({
|
await updatePkiCollection({
|
||||||
collectionId: pkiCollection.id,
|
collectionId: pkiCollection.id,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
projectId
|
projectId
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// create
|
|
||||||
const { id: collectionId } = await createPkiCollection({
|
|
||||||
name,
|
|
||||||
description,
|
|
||||||
projectId
|
|
||||||
});
|
|
||||||
|
|
||||||
navigate({
|
|
||||||
to: "/projects/cert-management/$projectId/pki-collections/$collectionId",
|
|
||||||
params: {
|
|
||||||
projectId,
|
|
||||||
collectionId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePopUpToggle("pkiCollection", false);
|
|
||||||
|
|
||||||
reset();
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Successfully ${pkiCollection ? "updated" : "created"} PKI collection`,
|
|
||||||
type: "success"
|
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} else {
|
||||||
console.error(err);
|
// create
|
||||||
createNotification({
|
const { id: collectionId } = await createPkiCollection({
|
||||||
text: `Failed to ${pkiCollection ? "updated" : "created"} PKI collection`,
|
name,
|
||||||
type: "error"
|
description,
|
||||||
|
projectId
|
||||||
|
});
|
||||||
|
|
||||||
|
navigate({
|
||||||
|
to: "/projects/cert-management/$projectId/pki-collections/$collectionId",
|
||||||
|
params: {
|
||||||
|
projectId,
|
||||||
|
collectionId
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlePopUpToggle("pkiCollection", false);
|
||||||
|
|
||||||
|
reset();
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: `Successfully ${pkiCollection ? "updated" : "created"} PKI collection`,
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -22,27 +22,19 @@ export const PkiCollectionSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemovePkiCollectionSubmit = async (collectionId: string) => {
|
const onRemovePkiCollectionSubmit = async (collectionId: string) => {
|
||||||
try {
|
if (!projectId) return;
|
||||||
if (!projectId) return;
|
|
||||||
|
|
||||||
await deletePkiCollection({
|
await deletePkiCollection({
|
||||||
collectionId,
|
collectionId,
|
||||||
projectId
|
projectId
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully deleted PKI collection",
|
text: "Successfully deleted PKI collection",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deletePkiCollection");
|
handlePopUpClose("deletePkiCollection");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete PKI collection",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+17
-24
@@ -57,33 +57,26 @@ const Page = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveCaSubmit = async () => {
|
const onRemoveCaSubmit = async () => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
await deleteCa({
|
await deleteCa({
|
||||||
caName,
|
caName,
|
||||||
projectId: currentProject.id,
|
projectId: currentProject.id,
|
||||||
type: CaType.INTERNAL
|
type: CaType.INTERNAL
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully deleted CA",
|
text: "Successfully deleted CA",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteCa");
|
handlePopUpClose("deleteCa");
|
||||||
navigate({
|
navigate({
|
||||||
to: "/projects/cert-management/$projectId/certificate-authorities",
|
to: "/projects/cert-management/$projectId/certificate-authorities",
|
||||||
params: {
|
params: {
|
||||||
projectId
|
projectId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+13
-17
@@ -84,27 +84,23 @@ export const CaRenewalModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
// }, [ca, parentCa]);
|
// }, [ca, parentCa]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ type, notAfter }: FormData) => {
|
const onFormSubmit = async ({ type, notAfter }: FormData) => {
|
||||||
try {
|
if (!projectSlug || !popUpData.caId) return;
|
||||||
if (!projectSlug || !popUpData.caId) return;
|
|
||||||
|
|
||||||
await renewCa({
|
await renewCa({
|
||||||
projectSlug,
|
projectSlug,
|
||||||
caId: popUpData.caId,
|
caId: popUpData.caId,
|
||||||
notAfter,
|
notAfter,
|
||||||
type
|
type
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpToggle("renewCa", false);
|
handlePopUpToggle("renewCa", false);
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully renewed CA",
|
text: "Successfully renewed CA",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+13
-20
@@ -48,29 +48,22 @@ export const ExternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onFormSubmit = async ({ certificate, certificateChain }: FormData) => {
|
const onFormSubmit = async ({ certificate, certificateChain }: FormData) => {
|
||||||
try {
|
if (!csr || !caId || !currentProject?.slug) return;
|
||||||
if (!csr || !caId || !currentProject?.slug) return;
|
|
||||||
|
|
||||||
await importCaCertificate({
|
await importCaCertificate({
|
||||||
caId,
|
caId,
|
||||||
projectSlug: currentProject?.slug,
|
projectSlug: currentProject?.slug,
|
||||||
certificate,
|
certificate,
|
||||||
certificateChain
|
certificateChain
|
||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully installed certificate for CA",
|
text: "Successfully installed certificate for CA",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
handlePopUpToggle("installCaCert", false);
|
handlePopUpToggle("installCaCert", false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to install certificate for CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const downloadTxtFile = (filename: string, content: string) => {
|
const downloadTxtFile = (filename: string, content: string) => {
|
||||||
|
|||||||
+20
-27
@@ -101,37 +101,30 @@ export const InternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
|
|||||||
}, [parentCa]);
|
}, [parentCa]);
|
||||||
|
|
||||||
const onFormSubmit = async ({ notAfter, maxPathLength }: FormData) => {
|
const onFormSubmit = async ({ notAfter, maxPathLength }: FormData) => {
|
||||||
try {
|
if (!csr || !caId || !currentProject?.slug) return;
|
||||||
if (!csr || !caId || !currentProject?.slug) return;
|
|
||||||
|
|
||||||
const { certificate, certificateChain } = await signIntermediate({
|
const { certificate, certificateChain } = await signIntermediate({
|
||||||
caId: parentCaId,
|
caId: parentCaId,
|
||||||
csr,
|
csr,
|
||||||
maxPathLength: Number(maxPathLength),
|
maxPathLength: Number(maxPathLength),
|
||||||
notAfter,
|
notAfter,
|
||||||
notBefore: new Date().toISOString()
|
notBefore: new Date().toISOString()
|
||||||
});
|
});
|
||||||
|
|
||||||
await importCaCertificate({
|
await importCaCertificate({
|
||||||
caId,
|
caId,
|
||||||
projectSlug: currentProject?.slug,
|
projectSlug: currentProject?.slug,
|
||||||
certificate,
|
certificate,
|
||||||
certificateChain
|
certificateChain
|
||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully installed certificate for CA",
|
text: "Successfully installed certificate for CA",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
handlePopUpToggle("installCaCert", false);
|
handlePopUpToggle("installCaCert", false);
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to install certificate for CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function generatePathLengthOpts(parentCaMaxPathLength: number): number[] {
|
function generatePathLengthOpts(parentCaMaxPathLength: number): number[] {
|
||||||
|
|||||||
@@ -175,48 +175,40 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
status,
|
status,
|
||||||
configuration
|
configuration
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
if (ca) {
|
if (ca) {
|
||||||
// update
|
// update
|
||||||
await updateMutateAsync({
|
await updateMutateAsync({
|
||||||
caName: ca.name,
|
caName: ca.name,
|
||||||
projectId: currentProject.id,
|
projectId: currentProject.id,
|
||||||
name,
|
name,
|
||||||
type: CaType.INTERNAL,
|
type: CaType.INTERNAL,
|
||||||
status,
|
status,
|
||||||
enableDirectIssuance
|
enableDirectIssuance
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// create
|
|
||||||
await createMutateAsync({
|
|
||||||
projectId: currentProject.id,
|
|
||||||
name,
|
|
||||||
type,
|
|
||||||
status,
|
|
||||||
enableDirectIssuance,
|
|
||||||
configuration: {
|
|
||||||
...configuration,
|
|
||||||
maxPathLength: Number(configuration.maxPathLength)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
reset();
|
|
||||||
handlePopUpToggle("ca", false);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Successfully ${ca ? "updated" : "created"} CA`,
|
|
||||||
type: "success"
|
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} else {
|
||||||
console.error(err);
|
// create
|
||||||
createNotification({
|
await createMutateAsync({
|
||||||
text: "Failed to create CA",
|
projectId: currentProject.id,
|
||||||
type: "error"
|
name,
|
||||||
|
type,
|
||||||
|
status,
|
||||||
|
enableDirectIssuance,
|
||||||
|
configuration: {
|
||||||
|
...configuration,
|
||||||
|
maxPathLength: Number(configuration.maxPathLength)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset();
|
||||||
|
handlePopUpToggle("ca", false);
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: `Successfully ${ca ? "updated" : "created"} CA`,
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+14
-29
@@ -27,44 +27,29 @@ export const CaSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveCaSubmit = async (caName: string) => {
|
const onRemoveCaSubmit = async (caName: string) => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
await deleteCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL });
|
await deleteCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL });
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully deleted CA",
|
text: "Successfully deleted CA",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteCa");
|
handlePopUpClose("deleteCa");
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onUpdateCaStatus = async ({ caName, status }: { caName: string; status: CaStatus }) => {
|
const onUpdateCaStatus = async ({ caName, status }: { caName: string; status: CaStatus }) => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
await updateCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL, status });
|
await updateCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL, status });
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
|
text: `Successfully ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("caStatus");
|
handlePopUpClose("caStatus");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+43
-51
@@ -297,63 +297,55 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
status,
|
status,
|
||||||
configuration: formConfiguration
|
configuration: formConfiguration
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
let configPayload: any;
|
let configPayload: any;
|
||||||
|
|
||||||
if (type === CaType.ACME && "dnsAppConnection" in formConfiguration) {
|
if (type === CaType.ACME && "dnsAppConnection" in formConfiguration) {
|
||||||
configPayload = {
|
configPayload = {
|
||||||
dnsProviderConfig: formConfiguration.dnsProviderConfig,
|
dnsProviderConfig: formConfiguration.dnsProviderConfig,
|
||||||
directoryUrl: formConfiguration.directoryUrl,
|
directoryUrl: formConfiguration.directoryUrl,
|
||||||
accountEmail: formConfiguration.accountEmail,
|
accountEmail: formConfiguration.accountEmail,
|
||||||
dnsAppConnectionId: formConfiguration.dnsAppConnection.id,
|
dnsAppConnectionId: formConfiguration.dnsAppConnection.id,
|
||||||
eabKid: formConfiguration.eabKid,
|
eabKid: formConfiguration.eabKid,
|
||||||
eabHmacKey: formConfiguration.eabHmacKey
|
eabHmacKey: formConfiguration.eabHmacKey
|
||||||
};
|
};
|
||||||
} else if (type === CaType.AZURE_AD_CS && "azureAdcsConnection" in formConfiguration) {
|
} else if (type === CaType.AZURE_AD_CS && "azureAdcsConnection" in formConfiguration) {
|
||||||
configPayload = {
|
configPayload = {
|
||||||
azureAdcsConnectionId: formConfiguration.azureAdcsConnection.id
|
azureAdcsConnectionId: formConfiguration.azureAdcsConnection.id
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Invalid certificate authority configuration");
|
throw new Error("Invalid certificate authority configuration");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ca) {
|
if (ca) {
|
||||||
await updateMutateAsync({
|
await updateMutateAsync({
|
||||||
caName: ca.name,
|
caName: ca.name,
|
||||||
projectId: currentProject.id,
|
projectId: currentProject.id,
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
status,
|
status,
|
||||||
enableDirectIssuance: type === CaType.AZURE_AD_CS ? false : enableDirectIssuance,
|
enableDirectIssuance: type === CaType.AZURE_AD_CS ? false : enableDirectIssuance,
|
||||||
configuration: configPayload
|
configuration: configPayload
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await createMutateAsync({
|
|
||||||
projectId: currentProject.id,
|
|
||||||
name,
|
|
||||||
type,
|
|
||||||
status,
|
|
||||||
enableDirectIssuance: type === CaType.AZURE_AD_CS ? false : enableDirectIssuance,
|
|
||||||
configuration: configPayload
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
reset();
|
|
||||||
handlePopUpToggle("ca", false);
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: `Successfully ${ca ? "updated" : "created"} CA`,
|
|
||||||
type: "success"
|
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} else {
|
||||||
console.error(err);
|
await createMutateAsync({
|
||||||
createNotification({
|
projectId: currentProject.id,
|
||||||
text: "Failed to create CA",
|
name,
|
||||||
type: "error"
|
type,
|
||||||
|
status,
|
||||||
|
enableDirectIssuance: type === CaType.AZURE_AD_CS ? false : enableDirectIssuance,
|
||||||
|
configuration: configPayload
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset();
|
||||||
|
handlePopUpToggle("ca", false);
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: `Successfully ${ca ? "updated" : "created"} CA`,
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+14
-29
@@ -23,23 +23,16 @@ export const ExternalCaSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveCaSubmit = async (caName: string, type: CaType) => {
|
const onRemoveCaSubmit = async (caName: string, type: CaType) => {
|
||||||
try {
|
if (!currentProject?.id) return;
|
||||||
if (!currentProject?.id) return;
|
|
||||||
|
|
||||||
await deleteCa({ caName, type, projectId: currentProject.id });
|
await deleteCa({ caName, type, projectId: currentProject.id });
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully deleted CA",
|
text: "Successfully deleted CA",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteCa");
|
handlePopUpClose("deleteCa");
|
||||||
} catch {
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete CA",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onUpdateCaStatus = async ({
|
const onUpdateCaStatus = async ({
|
||||||
@@ -51,24 +44,16 @@ export const ExternalCaSection = () => {
|
|||||||
type: CaType;
|
type: CaType;
|
||||||
status: CaStatus;
|
status: CaStatus;
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
await updateCa({ caName: name, type, status, projectId: currentProject.id });
|
await updateCa({ caName: name, type, status, projectId: currentProject.id });
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: `Successfully ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
|
text: `Successfully ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("caStatus");
|
handlePopUpClose("caStatus");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to ${status === CaStatus.ACTIVE ? "enable" : "disable"} CA`,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+19
-27
@@ -71,38 +71,30 @@ export const CertificateImportModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
chainPem,
|
chainPem,
|
||||||
collectionId
|
collectionId
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
const { serialNumber, certificate, certificateChain, privateKey } = await importCertificate({
|
const { serialNumber, certificate, certificateChain, privateKey } = await importCertificate({
|
||||||
projectSlug: currentProject.slug,
|
projectSlug: currentProject.slug,
|
||||||
|
|
||||||
certificatePem,
|
certificatePem,
|
||||||
privateKeyPem,
|
privateKeyPem,
|
||||||
chainPem,
|
chainPem,
|
||||||
pkiCollectionId: collectionId
|
pkiCollectionId: collectionId
|
||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
setCertificateDetails({
|
setCertificateDetails({
|
||||||
serialNumber,
|
serialNumber,
|
||||||
certificate,
|
certificate,
|
||||||
certificateChain,
|
certificateChain,
|
||||||
privateKey
|
privateKey
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully imported certificate",
|
text: "Successfully imported certificate",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to import certificate",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+62
-74
@@ -243,84 +243,72 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }
|
|||||||
keyUsages,
|
keyUsages,
|
||||||
extendedKeyUsages
|
extendedKeyUsages
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
if (!currentProject?.slug) {
|
||||||
if (!currentProject?.slug) {
|
|
||||||
createNotification({
|
|
||||||
text: "Project not found. Please refresh and try again.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!formProfileId) {
|
|
||||||
createNotification({
|
|
||||||
text: "Please select a certificate profile.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let commonName = "";
|
|
||||||
if (
|
|
||||||
constraints.shouldShowSubjectSection &&
|
|
||||||
subjectAttributes &&
|
|
||||||
subjectAttributes.length > 0
|
|
||||||
) {
|
|
||||||
commonName = getAttributeValue(subjectAttributes, "common_name");
|
|
||||||
if (!commonName.trim()) {
|
|
||||||
createNotification({
|
|
||||||
text: "Common name is required.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const certificateRequest: any = {
|
|
||||||
profileId: formProfileId,
|
|
||||||
projectSlug: currentProject.slug,
|
|
||||||
ttl,
|
|
||||||
signatureAlgorithm,
|
|
||||||
keyAlgorithm,
|
|
||||||
keyUsages: filterUsages(keyUsages) as CertKeyUsage[],
|
|
||||||
extendedKeyUsages: filterUsages(extendedKeyUsages) as CertExtendedKeyUsage[]
|
|
||||||
};
|
|
||||||
|
|
||||||
if (constraints.shouldShowSubjectSection && commonName) {
|
|
||||||
certificateRequest.commonName = commonName;
|
|
||||||
}
|
|
||||||
if (constraints.shouldShowSanSection && subjectAltNames && subjectAltNames.length > 0) {
|
|
||||||
const formattedSans = formatSubjectAltNames(subjectAltNames);
|
|
||||||
if (formattedSans && formattedSans.length > 0) {
|
|
||||||
certificateRequest.altNames = formattedSans;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const { serialNumber, certificate, certificateChain, privateKey } =
|
|
||||||
await createCertificate(certificateRequest);
|
|
||||||
|
|
||||||
setCertificateDetails({
|
|
||||||
serialNumber,
|
|
||||||
certificate,
|
|
||||||
certificateChain,
|
|
||||||
privateKey
|
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully created certificate",
|
text: "Project not found. Please refresh and try again.",
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
console.error("Certificate creation failed:", err);
|
|
||||||
const errorMessage =
|
|
||||||
err instanceof Error
|
|
||||||
? err.message
|
|
||||||
: "An unexpected error occurred while creating the certificate";
|
|
||||||
createNotification({
|
|
||||||
text: `Failed to create certificate: ${errorMessage}`,
|
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!formProfileId) {
|
||||||
|
createNotification({
|
||||||
|
text: "Please select a certificate profile.",
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let commonName = "";
|
||||||
|
if (
|
||||||
|
constraints.shouldShowSubjectSection &&
|
||||||
|
subjectAttributes &&
|
||||||
|
subjectAttributes.length > 0
|
||||||
|
) {
|
||||||
|
commonName = getAttributeValue(subjectAttributes, "common_name");
|
||||||
|
if (!commonName.trim()) {
|
||||||
|
createNotification({
|
||||||
|
text: "Common name is required.",
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const certificateRequest: any = {
|
||||||
|
profileId: formProfileId,
|
||||||
|
projectSlug: currentProject.slug,
|
||||||
|
ttl,
|
||||||
|
signatureAlgorithm,
|
||||||
|
keyAlgorithm,
|
||||||
|
keyUsages: filterUsages(keyUsages) as CertKeyUsage[],
|
||||||
|
extendedKeyUsages: filterUsages(extendedKeyUsages) as CertExtendedKeyUsage[]
|
||||||
|
};
|
||||||
|
|
||||||
|
if (constraints.shouldShowSubjectSection && commonName) {
|
||||||
|
certificateRequest.commonName = commonName;
|
||||||
|
}
|
||||||
|
if (constraints.shouldShowSanSection && subjectAltNames && subjectAltNames.length > 0) {
|
||||||
|
const formattedSans = formatSubjectAltNames(subjectAltNames);
|
||||||
|
if (formattedSans && formattedSans.length > 0) {
|
||||||
|
certificateRequest.altNames = formattedSans;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const { serialNumber, certificate, certificateChain, privateKey } =
|
||||||
|
await createCertificate(certificateRequest);
|
||||||
|
|
||||||
|
setCertificateDetails({
|
||||||
|
serialNumber,
|
||||||
|
certificate,
|
||||||
|
certificateChain,
|
||||||
|
privateKey
|
||||||
|
});
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: "Successfully created certificate",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
currentProject?.slug,
|
currentProject?.slug,
|
||||||
|
|||||||
+18
-28
@@ -163,38 +163,28 @@ export const CertificateManageRenewalModal = ({ popUp, handlePopUpToggle }: Prop
|
|||||||
}, [popUp.manageRenewal.isOpen, defaultRenewalDays, reset]);
|
}, [popUp.manageRenewal.isOpen, defaultRenewalDays, reset]);
|
||||||
|
|
||||||
const onUpdateRenewal = async (data: FormData) => {
|
const onUpdateRenewal = async (data: FormData) => {
|
||||||
try {
|
if (!currentProject?.slug) {
|
||||||
if (!currentProject?.slug) {
|
|
||||||
createNotification({
|
|
||||||
text: "Unable to update auto-renewal: Project not found. Please refresh the page and try again.",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await updateRenewalConfig({
|
|
||||||
certificateId: certificateData.certificateId,
|
|
||||||
renewBeforeDays: data.renewBeforeDays,
|
|
||||||
projectSlug: currentProject.slug
|
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: isAutoRenewalEnabled
|
text: "Unable to update auto-renewal: Project not found. Please refresh the page and try again.",
|
||||||
? "Auto-renewal configuration updated successfully"
|
|
||||||
: "Auto-renewal enabled successfully",
|
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
|
|
||||||
handlePopUpToggle("manageRenewal", false);
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: isAutoRenewalEnabled
|
|
||||||
? "Failed to update auto-renewal configuration. Please check your inputs and try again."
|
|
||||||
: "Failed to enable auto-renewal. Please check your inputs and try again.",
|
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await updateRenewalConfig({
|
||||||
|
certificateId: certificateData.certificateId,
|
||||||
|
renewBeforeDays: data.renewBeforeDays,
|
||||||
|
projectSlug: currentProject.slug
|
||||||
|
});
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: isAutoRenewalEnabled
|
||||||
|
? "Auto-renewal configuration updated successfully"
|
||||||
|
: "Auto-renewal enabled successfully",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
|
||||||
|
handlePopUpToggle("manageRenewal", false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getModalTitle = () => {
|
const getModalTitle = () => {
|
||||||
|
|||||||
@@ -186,45 +186,37 @@ export const CertificateModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
keyUsages,
|
keyUsages,
|
||||||
extendedKeyUsages
|
extendedKeyUsages
|
||||||
}: FormData) => {
|
}: FormData) => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
const { serialNumber, certificate, certificateChain, privateKey } = await createCertificate({
|
const { serialNumber, certificate, certificateChain, privateKey } = await createCertificate({
|
||||||
caId: !selectedCertTemplate ? caId : undefined,
|
caId: !selectedCertTemplate ? caId : undefined,
|
||||||
certificateTemplateId: selectedCertTemplate ? selectedCertTemplateId : undefined,
|
certificateTemplateId: selectedCertTemplate ? selectedCertTemplateId : undefined,
|
||||||
projectSlug: currentProject.slug,
|
projectSlug: currentProject.slug,
|
||||||
pkiCollectionId: collectionId,
|
pkiCollectionId: collectionId,
|
||||||
commonName,
|
commonName,
|
||||||
subjectAltNames,
|
subjectAltNames,
|
||||||
ttl,
|
ttl,
|
||||||
keyUsages: Object.entries(keyUsages)
|
keyUsages: Object.entries(keyUsages)
|
||||||
.filter(([, value]) => value)
|
.filter(([, value]) => value)
|
||||||
.map(([key]) => key as CertKeyUsage),
|
.map(([key]) => key as CertKeyUsage),
|
||||||
extendedKeyUsages: Object.entries(extendedKeyUsages)
|
extendedKeyUsages: Object.entries(extendedKeyUsages)
|
||||||
.filter(([, value]) => value)
|
.filter(([, value]) => value)
|
||||||
.map(([key]) => key as CertExtendedKeyUsage)
|
.map(([key]) => key as CertExtendedKeyUsage)
|
||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
setCertificateDetails({
|
setCertificateDetails({
|
||||||
serialNumber,
|
serialNumber,
|
||||||
certificate,
|
certificate,
|
||||||
certificateChain,
|
certificateChain,
|
||||||
privateKey
|
privateKey
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully created certificate",
|
text: "Successfully created certificate",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to create certificate",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
+16
-24
@@ -61,34 +61,26 @@ export const CertificateRenewalConfigModal = ({ popUp, handlePopUpToggle }: Prop
|
|||||||
const renewBeforeDays = watch("renewBeforeDays");
|
const renewBeforeDays = watch("renewBeforeDays");
|
||||||
|
|
||||||
const onSubmit = async (data: FormData) => {
|
const onSubmit = async (data: FormData) => {
|
||||||
try {
|
if (!currentProject?.slug) {
|
||||||
if (!currentProject?.slug) {
|
|
||||||
createNotification({
|
|
||||||
text: "Project not found",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await updateRenewalConfig({
|
|
||||||
certificateId: certificateData.certificateId,
|
|
||||||
renewBeforeDays: data.renewBeforeDays,
|
|
||||||
projectSlug: currentProject.slug
|
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully updated auto-renewal configuration",
|
text: "Project not found",
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
|
|
||||||
handlePopUpToggle("configureRenewal", false);
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to update auto-renewal configuration",
|
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await updateRenewalConfig({
|
||||||
|
certificateId: certificateData.certificateId,
|
||||||
|
renewBeforeDays: data.renewBeforeDays,
|
||||||
|
projectSlug: currentProject.slug
|
||||||
|
});
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: "Successfully updated auto-renewal configuration",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
|
||||||
|
handlePopUpToggle("configureRenewal", false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+16
-24
@@ -19,34 +19,26 @@ export const CertificateRenewalDisableModal = ({ popUp, handlePopUpToggle }: Pro
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onDisableConfirm = async () => {
|
const onDisableConfirm = async () => {
|
||||||
try {
|
if (!currentProject?.slug) {
|
||||||
if (!currentProject?.slug) {
|
|
||||||
createNotification({
|
|
||||||
text: "Project not found",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await updateRenewalConfig({
|
|
||||||
certificateId: certificateData.certificateId,
|
|
||||||
projectSlug: currentProject.slug,
|
|
||||||
enableAutoRenewal: false
|
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully disabled auto-renewal",
|
text: "Project not found",
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
|
|
||||||
handlePopUpToggle("disableRenewal", false);
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to disable auto-renewal",
|
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await updateRenewalConfig({
|
||||||
|
certificateId: certificateData.certificateId,
|
||||||
|
projectSlug: currentProject.slug,
|
||||||
|
enableAutoRenewal: false
|
||||||
|
});
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: "Successfully disabled auto-renewal",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
|
||||||
|
handlePopUpToggle("disableRenewal", false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+9
-13
@@ -18,22 +18,18 @@ export const CertificateRenewalModal = ({ popUp, handlePopUpToggle }: Props) =>
|
|||||||
const { mutateAsync: renewCertificate, isPending: isRenewing } = useRenewCertificate();
|
const { mutateAsync: renewCertificate, isPending: isRenewing } = useRenewCertificate();
|
||||||
|
|
||||||
const onRenewConfirm = async () => {
|
const onRenewConfirm = async () => {
|
||||||
try {
|
const { certificateId } = popUp.renewCertificate.data as { certificateId: string };
|
||||||
const { certificateId } = popUp.renewCertificate.data as { certificateId: string };
|
|
||||||
|
|
||||||
await renewCertificate({
|
await renewCertificate({
|
||||||
certificateId
|
certificateId
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Certificate renewed successfully",
|
text: "Certificate renewed successfully",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpToggle("renewCertificate", false);
|
handlePopUpToggle("renewCertificate", false);
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const certificateData = popUp.renewCertificate.data as {
|
const certificateData = popUp.renewCertificate.data as {
|
||||||
|
|||||||
+13
-21
@@ -48,31 +48,23 @@ export const CertificateRevocationModal = ({ popUp, handlePopUpToggle }: Props)
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onFormSubmit = async ({ revocationReason }: FormData) => {
|
const onFormSubmit = async ({ revocationReason }: FormData) => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
const { serialNumber } = popUp.revokeCertificate.data as { serialNumber: string };
|
const { serialNumber } = popUp.revokeCertificate.data as { serialNumber: string };
|
||||||
|
|
||||||
await revokeCertificate({
|
await revokeCertificate({
|
||||||
projectSlug: currentProject.slug,
|
projectSlug: currentProject.slug,
|
||||||
serialNumber,
|
serialNumber,
|
||||||
revocationReason
|
revocationReason
|
||||||
});
|
});
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
handlePopUpToggle("revokeCertificate", false);
|
handlePopUpToggle("revokeCertificate", false);
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully revoked certificate",
|
text: "Successfully revoked certificate",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to revoke certificate",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+51
-59
@@ -159,69 +159,61 @@ export const CertificateTemplateModal = ({ popUp, handlePopUpToggle, caId }: Pro
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (certTemplate) {
|
||||||
if (certTemplate) {
|
await updateCertTemplate({
|
||||||
await updateCertTemplate({
|
id: certTemplate.id,
|
||||||
id: certTemplate.id,
|
projectId: currentProject.id,
|
||||||
projectId: currentProject.id,
|
pkiCollectionId: collectionId,
|
||||||
pkiCollectionId: collectionId,
|
caId,
|
||||||
caId,
|
name,
|
||||||
name,
|
commonName,
|
||||||
commonName,
|
subjectAlternativeName,
|
||||||
subjectAlternativeName,
|
ttl,
|
||||||
ttl,
|
keyUsages: Object.entries(keyUsages)
|
||||||
keyUsages: Object.entries(keyUsages)
|
.filter(([, value]) => value)
|
||||||
.filter(([, value]) => value)
|
.map(([key]) =>
|
||||||
.map(([key]) =>
|
key === CertKeyUsage.CRL_SIGN
|
||||||
key === CertKeyUsage.CRL_SIGN
|
? "cRLSign"
|
||||||
? "cRLSign"
|
: key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())
|
||||||
: key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())
|
),
|
||||||
),
|
extendedKeyUsages: Object.entries(extendedKeyUsages)
|
||||||
extendedKeyUsages: Object.entries(extendedKeyUsages)
|
.filter(([, value]) => value)
|
||||||
.filter(([, value]) => value)
|
.map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))
|
||||||
.map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: "Successfully updated certificate template",
|
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await createCertTemplate({
|
|
||||||
projectId: currentProject.id,
|
|
||||||
pkiCollectionId: collectionId,
|
|
||||||
caId,
|
|
||||||
name,
|
|
||||||
commonName,
|
|
||||||
subjectAlternativeName,
|
|
||||||
ttl,
|
|
||||||
keyUsages: Object.entries(keyUsages)
|
|
||||||
.filter(([, value]) => value)
|
|
||||||
.map(([key]) =>
|
|
||||||
key === CertKeyUsage.CRL_SIGN
|
|
||||||
? "cRLSign"
|
|
||||||
: key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())
|
|
||||||
),
|
|
||||||
extendedKeyUsages: Object.entries(extendedKeyUsages)
|
|
||||||
.filter(([, value]) => value)
|
|
||||||
.map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))
|
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
|
||||||
text: "Successfully created certificate template",
|
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
reset();
|
|
||||||
handlePopUpToggle("certificateTemplate", false);
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Failed to save changes",
|
text: "Successfully updated certificate template",
|
||||||
type: "error"
|
type: "success"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await createCertTemplate({
|
||||||
|
projectId: currentProject.id,
|
||||||
|
pkiCollectionId: collectionId,
|
||||||
|
caId,
|
||||||
|
name,
|
||||||
|
commonName,
|
||||||
|
subjectAlternativeName,
|
||||||
|
ttl,
|
||||||
|
keyUsages: Object.entries(keyUsages)
|
||||||
|
.filter(([, value]) => value)
|
||||||
|
.map(([key]) =>
|
||||||
|
key === CertKeyUsage.CRL_SIGN
|
||||||
|
? "cRLSign"
|
||||||
|
: key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())
|
||||||
|
),
|
||||||
|
extendedKeyUsages: Object.entries(extendedKeyUsages)
|
||||||
|
.filter(([, value]) => value)
|
||||||
|
.map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))
|
||||||
|
});
|
||||||
|
|
||||||
|
createNotification({
|
||||||
|
text: "Successfully created certificate template",
|
||||||
|
type: "success"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset();
|
||||||
|
handlePopUpToggle("certificateTemplate", false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+9
-17
@@ -41,25 +41,17 @@ export const CertificateTemplatesSection = ({ caId }: Props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
await deleteCertTemplate({
|
||||||
await deleteCertTemplate({
|
id,
|
||||||
id,
|
projectId: currentProject.id
|
||||||
projectId: currentProject.id
|
});
|
||||||
});
|
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully deleted certificate template",
|
text: "Successfully deleted certificate template",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteCertificateTemplate");
|
handlePopUpClose("deleteCertificateTemplate");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete certificate template",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+7
-15
@@ -42,24 +42,16 @@ export const CertificatesSection = () => {
|
|||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
const onRemoveCertificateSubmit = async (serialNumber: string) => {
|
const onRemoveCertificateSubmit = async (serialNumber: string) => {
|
||||||
try {
|
if (!currentProject?.slug) return;
|
||||||
if (!currentProject?.slug) return;
|
|
||||||
|
|
||||||
await deleteCert({ serialNumber, projectSlug: currentProject.slug });
|
await deleteCert({ serialNumber, projectSlug: currentProject.slug });
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully deleted certificate",
|
text: "Successfully deleted certificate",
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
|
||||||
handlePopUpClose("deleteCertificate");
|
handlePopUpClose("deleteCertificate");
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
createNotification({
|
|
||||||
text: "Failed to delete certificate",
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user