Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
add servicenow app connection
adilsonedda741202d7
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex d8f014b536..0556a8dc50 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -3054,6 +3054,11 @@ export const AppConnections = {apiToken: "The API Token used to access Zabbix.",instanceUrl: "The Zabbix instance URL to connect with."},+ SERVICENOW: {+ instanceUrl: "The base URL of the ServiceNow instance to connect with, without a path or trailing slash.",+ username: "The User ID of the ServiceNow integration user.",+ password: "The password of the ServiceNow integration user."+ },RAILWAY: {apiToken: "The API token used to authenticate with Railway."},diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-endpoints.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-endpoints.tsindex 53970520f8..7f03f30333 100644--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-endpoints.ts+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-endpoints.ts@@ -69,7 +69,8 @@ export const buildAppConnectionRouteContext = ({[AppConnection.MySql]: "MySql",[AppConnection.OracleDB]: "OracleDb",[AppConnection.MongoDB]: "MongoDb",- [AppConnection.TravisCI]: "TravisCI"+ [AppConnection.TravisCI]: "TravisCI",+ [AppConnection.ServiceNow]: "ServiceNow"};const appNameForOpId =operationIdPrefix +diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.tsindex 32ef3f5221..01510be0c0 100644--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts@@ -228,6 +228,10 @@ import {SalesforceConnectionListItemSchema,SanitizedSalesforceConnectionSchema} from "@app/services/app-connection/salesforce";+import {+ SanitizedServiceNowConnectionSchema,+ ServiceNowConnectionListItemSchema+} from "@app/services/app-connection/servicenow";import { SanitizedSmbConnectionSchema, SmbConnectionListItemSchema } from "@app/services/app-connection/smb";import {SanitizedSnowflakeConnectionSchema,@@ -371,7 +375,8 @@ const SanitizedAppConnectionSchema = z.union([...SanitizedDaytonaConnectionSchema.options,...SanitizedStripeConnectionSchema.options,...SanitizedKeeperConnectionSchema.options,- ...SanitizedHpeIloConnectionSchema.options+ ...SanitizedHpeIloConnectionSchema.options,+ ...SanitizedServiceNowConnectionSchema.options]);const AppConnectionOptionsSchema = z.discriminatedUnion("app", [@@ -464,7 +469,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [DaytonaConnectionListItemSchema,StripeConnectionListItemSchema,KeeperConnectionListItemSchema,- HpeIloConnectionListItemSchema+ HpeIloConnectionListItemSchema,+ ServiceNowConnectionListItemSchema]);export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.tsindex 6cdc22cca9..80816a5839 100644--- a/backend/src/server/routes/v1/app-connection-routers/index.ts+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts@@ -73,6 +73,7 @@ import { registerRedisConnectionRouter } from "./redis-connection-router";import { registerRenderConnectionRouter } from "./render-connection-router";import { registerRundeckConnectionRouter } from "./rundeck-connection-router";import { registerSalesforceConnectionRouter } from "./salesforce-connection-router";+import { registerServiceNowConnectionRouter } from "./servicenow-connection-router";import { registerSmbConnectionRouter } from "./smb-connection-router";import { registerSnowflakeConnectionRouter } from "./snowflake-connection-router";import { registerSpaceliftConnectionRouter } from "./spacelift-connection-router";@@ -184,5 +185,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:[AppConnection.Daytona]: registerDaytonaConnectionRouter,[AppConnection.Stripe]: registerStripeConnectionRouter,[AppConnection.Keeper]: registerKeeperConnectionRouter,- [AppConnection.HpeIloRedFish]: registerHpeIloConnectionRouter+ [AppConnection.HpeIloRedFish]: registerHpeIloConnectionRouter,+ [AppConnection.ServiceNow]: registerServiceNowConnectionRouter};diff --git a/backend/src/server/routes/v1/app-connection-routers/servicenow-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/servicenow-connection-router.tsnew file mode 100644index 0000000000..f32243e479--- /dev/null+++ b/backend/src/server/routes/v1/app-connection-routers/servicenow-connection-router.ts@@ -0,0 +1,18 @@+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ CreateServiceNowConnectionSchema,+ SanitizedServiceNowConnectionSchema,+ UpdateServiceNowConnectionSchema+} from "@app/services/app-connection/servicenow";++import { registerAppConnectionEndpoints } from "./app-connection-endpoints";++export const registerServiceNowConnectionRouter = async (server: FastifyZodProvider) => {+ registerAppConnectionEndpoints({+ app: AppConnection.ServiceNow,+ server,+ sanitizedResponseSchema: SanitizedServiceNowConnectionSchema,+ createSchema: CreateServiceNowConnectionSchema,+ updateSchema: UpdateServiceNowConnectionSchema+ });+};diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.tsindex e6d80a3d5c..f83b5951d0 100644--- a/backend/src/services/app-connection/app-connection-enums.ts+++ b/backend/src/services/app-connection/app-connection-enums.ts@@ -88,7 +88,8 @@ export enum AppConnection {Daytona = "daytona",Stripe = "stripe",Keeper = "keeper",- HpeIloRedFish = "hpe-ilo"+ HpeIloRedFish = "hpe-ilo",+ ServiceNow = "servicenow"}export enum AWSRegion {diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.tsindex 711049f32a..499027e92c 100644--- a/backend/src/services/app-connection/app-connection-fns.ts+++ b/backend/src/services/app-connection/app-connection-fns.ts@@ -263,6 +263,11 @@ import {SalesforceConnectionMethod,validateSalesforceConnectionCredentials} from "./salesforce";+import {+ getServiceNowConnectionListItem,+ ServiceNowConnectionMethod,+ validateServiceNowConnectionCredentials+} from "./servicenow";import { getSmbConnectionListItem, SmbConnectionMethod, validateSmbConnectionCredentials } from "./smb";import {getSnowflakeConnectionListItem,@@ -364,6 +369,10 @@ const PKI_APP_CONNECTIONS = [AppConnection.MicrosoftIntune];+// Secret Manager connections that are not reached through a sync, rotation or external migration,+// so none of the maps above surface them.+const SECRET_MANAGER_APP_CONNECTIONS = [AppConnection.ServiceNow];+const AGENT_VAULT_APP_CONNECTIONS = [AppConnection.AWS];export const isAppConnectionAllowedInProject = (app: AppConnection, projectType?: ProjectType) => {@@ -372,7 +381,8 @@ export const isAppConnectionAllowedInProject = (app: AppConnection, projectType?return (Boolean(SECRET_SYNC_APP_CONNECTION_MAP[app]) ||Boolean(SECRET_ROTATION_APP_CONNECTION_MAP[app]) ||- EXTERNAL_MIGRATION_APP_CONNECTIONS.includes(app)+ EXTERNAL_MIGRATION_APP_CONNECTIONS.includes(app) ||+ SECRET_MANAGER_APP_CONNECTIONS.includes(app));case ProjectType.SecretScanning:return Boolean(SECRET_SCANNING_APP_CONNECTION_MAP[app]);@@ -484,7 +494,8 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {getDaytonaConnectionListItem(),getStripeConnectionListItem(),getKeeperConnectionListItem(),- getHpeIloConnectionListItem()+ getHpeIloConnectionListItem(),+ getServiceNowConnectionListItem()].filter((option) => isAppConnectionAllowedInProject(option.app, projectType)).sort((a, b) => a.name.localeCompare(b.name));@@ -725,7 +736,8 @@ export const validateAppConnectionCredentials = async ([AppConnection.Daytona]: validateDaytonaConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Stripe]: validateStripeConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Keeper]: validateKeeperConnectionCredentials as TAppConnectionCredentialsValidator,- [AppConnection.HpeIloRedFish]: validateHpeIloConnectionCredentials as TAppConnectionCredentialsValidator+ [AppConnection.HpeIloRedFish]: validateHpeIloConnectionCredentials as TAppConnectionCredentialsValidator,+ [AppConnection.ServiceNow]: validateServiceNowConnectionCredentials as TAppConnectionCredentialsValidator};return VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection, gatewayV2Service);@@ -851,6 +863,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>case F5BigIpConnectionMethod.BasicAuth:case NutanixPrismCentralConnectionMethod.BasicAuth:case HpeIloConnectionMethod.BasicAuth:+ case ServiceNowConnectionMethod.BasicAuth:return "Basic Auth";case ExternalInfisicalConnectionMethod.MachineIdentityUniversalAuth:return "Machine Identity - Universal Auth";@@ -1009,7 +1022,8 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<[AppConnection.Daytona]: platformManagedCredentialsNotSupported,[AppConnection.Stripe]: platformManagedCredentialsNotSupported,[AppConnection.Keeper]: platformManagedCredentialsNotSupported,- [AppConnection.HpeIloRedFish]: platformManagedCredentialsNotSupported+ [AppConnection.HpeIloRedFish]: platformManagedCredentialsNotSupported,+ [AppConnection.ServiceNow]: platformManagedCredentialsNotSupported};export const enterpriseAppCheck = async (diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.tsindex 3eaf869cc5..2d61c7f473 100644--- a/backend/src/services/app-connection/app-connection-maps.ts+++ b/backend/src/services/app-connection/app-connection-maps.ts@@ -90,7 +90,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {[AppConnection.MicrosoftIntune]: "Microsoft Intune",[AppConnection.Stripe]: "Stripe",[AppConnection.Keeper]: "Keeper",- [AppConnection.HpeIloRedFish]: "HPE iLO"+ [AppConnection.HpeIloRedFish]: "HPE iLO",+ [AppConnection.ServiceNow]: "ServiceNow"};export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {@@ -183,5 +184,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp[AppConnection.MicrosoftIntune]: AppConnectionPlanType.Enterprise,[AppConnection.Stripe]: AppConnectionPlanType.Regular,[AppConnection.Keeper]: AppConnectionPlanType.Regular,- [AppConnection.HpeIloRedFish]: AppConnectionPlanType.Regular+ [AppConnection.HpeIloRedFish]: AppConnectionPlanType.Regular,+ [AppConnection.ServiceNow]: AppConnectionPlanType.Enterprise};diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex 4b04ce9f07..7b5b7cdf05 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -188,6 +188,7 @@ import { ValidateRundeckConnectionCredentialsSchema } from "./rundeck";import { rundeckConnectionService } from "./rundeck/rundeck-connection-service";import { ValidateSalesforceConnectionCredentialsSchema } from "./salesforce";import { salesforceConnectionService } from "./salesforce/salesforce-connection-service";+import { ValidateServiceNowConnectionCredentialsSchema } from "./servicenow";import { ValidateSmbConnectionCredentialsSchema } from "./smb";import { ValidateSnowflakeConnectionCredentialsSchema } from "./snowflake";import { snowflakeConnectionService } from "./snowflake/snowflake-connection-service";@@ -332,7 +333,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp[AppConnection.Daytona]: ValidateDaytonaConnectionCredentialsSchema,[AppConnection.Stripe]: ValidateStripeConnectionCredentialsSchema,[AppConnection.Keeper]: ValidateKeeperConnectionCredentialsSchema,- [AppConnection.HpeIloRedFish]: ValidateHpeIloConnectionCredentialsSchema+ [AppConnection.HpeIloRedFish]: ValidateHpeIloConnectionCredentialsSchema,+ [AppConnection.ServiceNow]: ValidateServiceNowConnectionCredentialsSchema};export const appConnectionServiceFactory = ({diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.tsindex 212490ee17..300d9fe468 100644--- a/backend/src/services/app-connection/app-connection-types.ts+++ b/backend/src/services/app-connection/app-connection-types.ts@@ -430,6 +430,12 @@ import {TSalesforceConnectionInput,TValidateSalesforceConnectionCredentialsSchema} from "./salesforce";+import {+ TServiceNowConnection,+ TServiceNowConnectionConfig,+ TServiceNowConnectionInput,+ TValidateServiceNowConnectionCredentialsSchema+} from "./servicenow";import {TSmbConnection,TSmbConnectionConfig,@@ -626,6 +632,7 @@ export type TAppConnection = { id: string; configuration?: TAppConnectionConfigu| TStripeConnection| TKeeperConnection| THpeIloConnection+ | TServiceNowConnection);export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;@@ -727,6 +734,7 @@ export type TAppConnectionInput = { id: string } & (| TStripeConnectionInput| TKeeperConnectionInput| THpeIloConnectionInput+ | TServiceNowConnectionInput);export type TSqlConnectionInput =@@ -861,7 +869,8 @@ export type TAppConnectionConfig =| TDaytonaConnectionConfig| TStripeConnectionConfig| TKeeperConnectionConfig- | THpeIloConnectionConfig;+ | THpeIloConnectionConfig+ | TServiceNowConnectionConfig;export type TValidateAppConnectionCredentialsSchema =| TValidateAwsConnectionCredentialsSchema@@ -953,7 +962,8 @@ export type TValidateAppConnectionCredentialsSchema =| TValidateDaytonaConnectionCredentialsSchema| TValidateStripeConnectionCredentialsSchema| TValidateKeeperConnectionCredentialsSchema- | TValidateHpeIloConnectionCredentialsSchema;+ | TValidateHpeIloConnectionCredentialsSchema+ | TValidateServiceNowConnectionCredentialsSchema;export type TListAwsConnectionKmsKeys = {connectionId: string;diff --git a/backend/src/services/app-connection/servicenow/index.ts b/backend/src/services/app-connection/servicenow/index.tsnew file mode 100644index 0000000000..29ac14a501--- /dev/null+++ b/backend/src/services/app-connection/servicenow/index.ts@@ -0,0 +1,4 @@+export * from "./servicenow-connection-enums";+export * from "./servicenow-connection-fns";+export * from "./servicenow-connection-schemas";+export * from "./servicenow-connection-types";diff --git a/backend/src/services/app-connection/servicenow/servicenow-connection-enums.ts b/backend/src/services/app-connection/servicenow/servicenow-connection-enums.tsnew file mode 100644index 0000000000..10ad0b5e0e--- /dev/null+++ b/backend/src/services/app-connection/servicenow/servicenow-connection-enums.ts@@ -0,0 +1,3 @@+export enum ServiceNowConnectionMethod {+ BasicAuth = "basic-auth"+}diff --git a/backend/src/services/app-connection/servicenow/servicenow-connection-fns.ts b/backend/src/services/app-connection/servicenow/servicenow-connection-fns.tsnew file mode 100644index 0000000000..9773454ac4--- /dev/null+++ b/backend/src/services/app-connection/servicenow/servicenow-connection-fns.ts@@ -0,0 +1,57 @@+import { AxiosError } from "axios";++import { BadRequestError } from "@app/lib/errors";+import { logger, sanitizeUrlForLog } from "@app/lib/logger";+import { safeRequest } from "@app/lib/validator/safe-request";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";++import { ServiceNowConnectionMethod } from "./servicenow-connection-enums";+import { TServiceNowConnectionConfig } from "./servicenow-connection-types";++export const getServiceNowConnectionListItem = () => {+ return {+ name: "ServiceNow" as const,+ app: AppConnection.ServiceNow as const,+ methods: Object.values(ServiceNowConnectionMethod) as [ServiceNowConnectionMethod.BasicAuth]+ };+};++export const validateServiceNowConnectionCredentials = async (config: TServiceNowConnectionConfig) => {+ const { instanceUrl, username, password } = config.credentials;++ try {+ await safeRequest.get(`${instanceUrl}/api/now/ui/user/current_user`, {+ auth: { username, password },+ headers: { Accept: "application/json" }+ });+ } catch (error) {+ // safeRequest's own refusals (private IP, unresolvable host, credentials in the URL) already+ // name what is wrong, and are more useful than the generic fallback below.+ if (error instanceof BadRequestError) throw error;++ const status = error instanceof AxiosError ? error.response?.status : undefined;++ // The raw Axios error is deliberately not logged: it carries the password at+ // config.auth.password, which sits past the logger's depth-three redaction.+ logger.error(+ { status, instanceUrl: sanitizeUrlForLog(instanceUrl), message: (error as Error)?.message },+ `Failed to validate ServiceNow connection [instanceUrl=${sanitizeUrlForLog(instanceUrl)}] [status=${status ?? "none"}]`+ );++ // ServiceNow answers an unauthenticated request with a 302 to its login page, and safeRequest+ // does not follow redirects, so a rejected credential arrives here as a 3xx rather than a 401.+ if (status === 401 || status === 403 || (status && status >= 300 && status < 400)) {+ throw new BadRequestError({+ message:+ "Unable to connect to ServiceNow: verify the username and password of the integration user, and that the account is active."+ });+ }++ throw new BadRequestError({+ message:+ "Unable to connect to ServiceNow: verify the instance URL is correct and that the instance is reachable from Infisical."+ });+ }++ return config.credentials;+};diff --git a/backend/src/services/app-connection/servicenow/servicenow-connection-schemas.ts b/backend/src/services/app-connection/servicenow/servicenow-connection-schemas.tsnew file mode 100644index 0000000000..787abf17c9--- /dev/null+++ b/backend/src/services/app-connection/servicenow/servicenow-connection-schemas.ts@@ -0,0 +1,85 @@+import z from "zod";++import { AppConnections } from "@app/lib/api-docs";+import { removeTrailingSlash } from "@app/lib/fn";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ BaseAppConnectionSchema,+ GenericCreateAppConnectionFieldsSchema,+ GenericUpdateAppConnectionFieldsSchema+} from "@app/services/app-connection/app-connection-schemas";++import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";+import { ServiceNowConnectionMethod } from "./servicenow-connection-enums";++export const ServiceNowConnectionBasicAuthCredentialsSchema = z.object({+ instanceUrl: z+ .string()+ .trim()+ .max(512, "Instance URL cannot exceed 512 characters")+ .url("Invalid Instance URL")+ .refine((value) => value.startsWith("https://"), "Instance URL must use HTTPS")+ .refine((value) => {+ const { pathname, search, hash } = new URL(value);+ return (pathname === "" || pathname === "/") && !search && !hash;+ }, "Instance URL must be the base URL of your ServiceNow instance, without a path or query string")+ .transform(removeTrailingSlash)+ .describe(AppConnections.CREDENTIALS.SERVICENOW.instanceUrl),+ username: z+ .string()+ .trim()+ .min(1, "Username is required")+ .max(256, "Username cannot exceed 256 characters")+ .describe(AppConnections.CREDENTIALS.SERVICENOW.username),+ password: z+ .string()+ .trim()+ .min(1, "Password is required")+ .max(512, "Password cannot exceed 512 characters")+ .describe(AppConnections.CREDENTIALS.SERVICENOW.password)+});++const BaseServiceNowConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.ServiceNow) });++export const ServiceNowConnectionSchema = BaseServiceNowConnectionSchema.extend({+ method: z.literal(ServiceNowConnectionMethod.BasicAuth),+ credentials: ServiceNowConnectionBasicAuthCredentialsSchema+});++export const SanitizedServiceNowConnectionSchema = z.discriminatedUnion("method", [+ BaseServiceNowConnectionSchema.extend({+ method: z.literal(ServiceNowConnectionMethod.BasicAuth),+ credentials: ServiceNowConnectionBasicAuthCredentialsSchema.pick({ instanceUrl: true, username: true })+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.ServiceNow]} (Basic Auth)` }))+]);++export const ValidateServiceNowConnectionCredentialsSchema = z.discriminatedUnion("method", [+ z.object({+ method: z+ .literal(ServiceNowConnectionMethod.BasicAuth)+ .describe(AppConnections.CREATE(AppConnection.ServiceNow).method),+ credentials: ServiceNowConnectionBasicAuthCredentialsSchema.describe(+ AppConnections.CREATE(AppConnection.ServiceNow).credentials+ )+ })+]);++export const CreateServiceNowConnectionSchema = ValidateServiceNowConnectionCredentialsSchema.and(+ GenericCreateAppConnectionFieldsSchema(AppConnection.ServiceNow)+);++export const UpdateServiceNowConnectionSchema = z+ .object({+ credentials: ServiceNowConnectionBasicAuthCredentialsSchema.optional().describe(+ AppConnections.UPDATE(AppConnection.ServiceNow).credentials+ )+ })+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.ServiceNow));++export const ServiceNowConnectionListItemSchema = z+ .object({+ name: z.literal("ServiceNow"),+ app: z.literal(AppConnection.ServiceNow),+ methods: z.nativeEnum(ServiceNowConnectionMethod).array()+ })+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.ServiceNow] }));diff --git a/backend/src/services/app-connection/servicenow/servicenow-connection-types.ts b/backend/src/services/app-connection/servicenow/servicenow-connection-types.tsnew file mode 100644index 0000000000..8bf05216bf--- /dev/null+++ b/backend/src/services/app-connection/servicenow/servicenow-connection-types.ts@@ -0,0 +1,25 @@+import z from "zod";++import { DiscriminativePick } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import {+ CreateServiceNowConnectionSchema,+ ServiceNowConnectionSchema,+ ValidateServiceNowConnectionCredentialsSchema+} from "./servicenow-connection-schemas";++export type TServiceNowConnection = z.infer<typeof ServiceNowConnectionSchema>;++export type TServiceNowConnectionInput = z.infer<typeof CreateServiceNowConnectionSchema> & {+ app: AppConnection.ServiceNow;+};++export type TValidateServiceNowConnectionCredentialsSchema = typeof ValidateServiceNowConnectionCredentialsSchema;++export type TServiceNowConnectionConfig = DiscriminativePick<+ TServiceNowConnectionInput,+ "method" | "app" | "credentials"+> & {+ orgId: string;+};diff --git a/docs/api-reference/endpoints/app-connections/servicenow/available.mdx b/docs/api-reference/endpoints/app-connections/servicenow/available.mdxnew file mode 100644index 0000000000..189f82f12a--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/servicenow/available.mdx@@ -0,0 +1,4 @@+---+title: "Available"+openapi: "GET /api/v1/app-connections/servicenow/available"+---diff --git a/docs/api-reference/endpoints/app-connections/servicenow/create.mdx b/docs/api-reference/endpoints/app-connections/servicenow/create.mdxnew file mode 100644index 0000000000..26816bb5f2--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/servicenow/create.mdx@@ -0,0 +1,8 @@+---+title: "Create"+openapi: "POST /api/v1/app-connections/servicenow"+---++<Note>+ Check out the configuration docs for [ServiceNow Connections](/integrations/app-connections/servicenow) to learn how to obtain the required credentials.+</Note>diff --git a/docs/api-reference/endpoints/app-connections/servicenow/delete.mdx b/docs/api-reference/endpoints/app-connections/servicenow/delete.mdxnew file mode 100644index 0000000000..57e112ecbc--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/servicenow/delete.mdx@@ -0,0 +1,4 @@+---+title: "Delete"+openapi: "DELETE /api/v1/app-connections/servicenow/{connectionId}"+---diff --git a/docs/api-reference/endpoints/app-connections/servicenow/get-by-id.mdx b/docs/api-reference/endpoints/app-connections/servicenow/get-by-id.mdxnew file mode 100644index 0000000000..1169e764d9--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/servicenow/get-by-id.mdx@@ -0,0 +1,4 @@+---+title: "Get by ID"+openapi: "GET /api/v1/app-connections/servicenow/{connectionId}"+---diff --git a/docs/api-reference/endpoints/app-connections/servicenow/get-by-name.mdx b/docs/api-reference/endpoints/app-connections/servicenow/get-by-name.mdxnew file mode 100644index 0000000000..308348a76d--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/servicenow/get-by-name.mdx@@ -0,0 +1,4 @@+---+title: "Get by name"+openapi: "GET /api/v1/app-connections/servicenow/connection-name/{connectionName}"+---diff --git a/docs/api-reference/endpoints/app-connections/servicenow/list.mdx b/docs/api-reference/endpoints/app-connections/servicenow/list.mdxnew file mode 100644index 0000000000..e47974bcf6--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/servicenow/list.mdx@@ -0,0 +1,4 @@+---+title: "List"+openapi: "GET /api/v1/app-connections/servicenow"+---diff --git a/docs/api-reference/endpoints/app-connections/servicenow/update.mdx b/docs/api-reference/endpoints/app-connections/servicenow/update.mdxnew file mode 100644index 0000000000..84a3568ba9--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/servicenow/update.mdx@@ -0,0 +1,8 @@+---+title: "Update"+openapi: "PATCH /api/v1/app-connections/servicenow/{connectionId}"+---++<Note>+ Check out the configuration docs for [ServiceNow Connections](/integrations/app-connections/servicenow) to learn how to obtain the required credentials.+</Note>diff --git a/docs/docs.json b/docs/docs.jsonindex 5e9034ea94..5a2b3ac997 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -2438,6 +2438,18 @@"api-reference/endpoints/app-connections/stripe/delete"]},+ {+ "group": "ServiceNow",+ "pages": [+ "api-reference/endpoints/app-connections/servicenow/list",+ "api-reference/endpoints/app-connections/servicenow/available",+ "api-reference/endpoints/app-connections/servicenow/get-by-id",+ "api-reference/endpoints/app-connections/servicenow/get-by-name",+ "api-reference/endpoints/app-connections/servicenow/create",+ "api-reference/endpoints/app-connections/servicenow/update",+ "api-reference/endpoints/app-connections/servicenow/delete"+ ]+ },{"group": "Supabase","pages": [diff --git a/docs/integrations/app-connections/servicenow.mdx b/docs/integrations/app-connections/servicenow.mdxindex d4874b58a7..c020c82be0 100644--- a/docs/integrations/app-connections/servicenow.mdx+++ b/docs/integrations/app-connections/servicenow.mdx@@ -15,6 +15,7 @@ Infisical connects to ServiceNow using basic authentication. The connection is u- The Infisical application installed on your ServiceNow instance. See the [ServiceNow Integration](/documentation/platform/workflow-integrations/servicenow-integration) guide for installation.- Permission to create users and assign roles on the ServiceNow instance.+- A ServiceNow instance that Infisical can reach over the public internet. If your instance restricts inbound traffic, allow Infisical's egress IPs on its IP access control list.## Create a ServiceNow integration user@@ -55,7 +56,8 @@ Use a dedicated ServiceNow user for the connection rather than a personal accoun<Steps><Step title="Navigate to App Connections">- In your Infisical organization, go to **Integrations** > **App Connections** and select **Add Connection**.+ Go to **Integrations** > **App Connections** and select **Add Connection**. You can create the connection at+ the organization level, or inside the Secrets Management project that uses it.</Step><Step title="Select ServiceNow">Choose **ServiceNow** from the list of available connections.@@ -67,13 +69,13 @@ Use a dedicated ServiceNow user for the connection rather than a personal accoun- **Username**: the User ID of the integration user.- **Password**: the password for the integration user.- Optionally select a **Gateway** to route the connection through an Infisical Gateway if your ServiceNow instance is not reachable from the public internet.-Click **Connect to ServiceNow**. Infisical validates the credentials against the instance before saving.</Step><Step title="Connection created">The connection is now available to select when configuring an access policy with ServiceNow approvals.++ Infisical verifies that the username and password authenticate against the instance. It does not check the integration role or whether the Infisical application is installed. A problem with either one surfaces the first time Infisical sends an access request.</Step></Steps>@@ -83,9 +85,8 @@ Change the password on the ServiceNow integration user, then update the **Passwo## Troubleshooting-| Symptom | Cause |-| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |-| `401 Unauthorized` when saving the connection | Wrong username or password, or the user is locked out. Verify the credential by signing in with the ServiceNow REST API Explorer. |-| `403 Forbidden` when saving the connection | The user is missing the `x_infis_approvals.secret-manager-integration` role. |-| `404 Not Found` when saving the connection | The Infisical application is not installed on the instance, or the instance URL points at the wrong instance. |-| Connection times out | The instance is not reachable from Infisical. Use an Infisical Gateway, or allow Infisical's egress IPs on your instance's IP access control list. |+| Symptom | Cause |+| --- | --- |+| Infisical cannot verify the username and password | Wrong username or password, or the user is locked out or inactive. Verify the credential by signing in with the ServiceNow REST API Explorer. |+| Infisical cannot reach the instance | The instance URL is wrong, or your instance blocks traffic from Infisical. Allow Infisical's egress IPs on your instance's IP access control list. |+| Access requests fail after the connection saves | The user is missing the `x_infis_approvals.secret-manager-integration` role, or the Infisical application is not installed on the instance. |diff --git a/docs/snippets/catalogs/app-connections.jsx b/docs/snippets/catalogs/app-connections.jsxindex 7367c605eb..d035fe5c05 100644--- a/docs/snippets/catalogs/app-connections.jsx+++ b/docs/snippets/catalogs/app-connections.jsx@@ -386,6 +386,14 @@ export const appConnections = ["Learn how to connect your Salesforce to pull secrets from Infisical.",category: "SaaS",},+ {+ name: "ServiceNow",+ slug: "servicenow",+ path: "/integrations/app-connections/servicenow",+ description:+ "Learn how to connect ServiceNow to route Infisical access requests through ServiceNow approvals.",+ category: "SaaS",+ },{name: "OpenRouter",slug: "openrouter",diff --git a/frontend/public/images/integrations/ServiceNow.png b/frontend/public/images/integrations/ServiceNow.pngnew file mode 100644index 0000000000..69d7d888e6Binary files /dev/null and b/frontend/public/images/integrations/ServiceNow.png differdiff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.tsindex b6c157f6e4..b0faa25a83 100644--- a/frontend/src/helpers/appConnections.ts+++ b/frontend/src/helpers/appConnections.ts@@ -94,6 +94,7 @@ import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/raiimport { RenderConnectionMethod } from "@app/hooks/api/appConnections/types/render-connection";import { RundeckConnectionMethod } from "@app/hooks/api/appConnections/types/rundeck-connection";import { SalesforceConnectionMethod } from "@app/hooks/api/appConnections/types/salesforce-connection";+import { ServiceNowConnectionMethod } from "@app/hooks/api/appConnections/types/servicenow-connection";import { SmbConnectionMethod } from "@app/hooks/api/appConnections/types/smb-connection";import { SnowflakeConnectionMethod } from "@app/hooks/api/appConnections/types/snowflake-connection";import { SpaceliftConnectionMethod } from "@app/hooks/api/appConnections/types/spacelift-connection";@@ -673,6 +674,13 @@ export const APP_CONNECTION_MAP: Record<image: "Daytona.png",category: "PLATFORM",description: "Organization secret access for Daytona sandboxes."+ },+ [AppConnection.ServiceNow]: {+ name: "ServiceNow",+ image: "ServiceNow.png",+ category: "PLATFORM",+ description: "Route access requests through ServiceNow approvals.",+ enterprise: true}};@@ -825,6 +833,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])case NutanixPrismCentralConnectionMethod.BasicAuth:case F5BigIpConnectionMethod.BasicAuth:case HpeIloConnectionMethod.BasicAuth:+ case ServiceNowConnectionMethod.BasicAuth:return { name: "Basic Auth", icon: LockIcon };case NutanixPrismCentralConnectionMethod.ApiKey:return { name: "API Key", icon: KeyRoundIcon };diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.tsindex 0f580bf115..ba8f3c9d19 100644--- a/frontend/src/hooks/api/appConnections/enums.ts+++ b/frontend/src/hooks/api/appConnections/enums.ts@@ -88,5 +88,6 @@ export enum AppConnection {Daytona = "daytona",Stripe = "stripe",Keeper = "keeper",- HpeIloRedFish = "hpe-ilo"+ HpeIloRedFish = "hpe-ilo",+ ServiceNow = "servicenow"}diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.tsindex c892ed8c0c..801f893d66 100644--- a/frontend/src/hooks/api/appConnections/types/app-options.ts+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts@@ -375,6 +375,10 @@ export type TDaytonaConnectionOption = TAppConnectionOptionBase & {app: AppConnection.Daytona;};+export type TServiceNowConnectionOption = TAppConnectionOptionBase & {+ app: AppConnection.ServiceNow;+};+export type TAppConnectionOption =| TAwsConnectionOption| TGitHubConnectionOption@@ -465,7 +469,8 @@ export type TAppConnectionOption =| TFireworksConnectionOption| TNutanixPrismCentralConnectionOption| TSpaceliftConnectionOption- | TDaytonaConnectionOption;+ | TDaytonaConnectionOption+ | TServiceNowConnectionOption;export type TAppConnectionOptionMap = {[AppConnection.AWS]: TAwsConnectionOption;@@ -558,4 +563,5 @@ export type TAppConnectionOptionMap = {[AppConnection.NutanixPrismCentral]: TNutanixPrismCentralConnectionOption;[AppConnection.Spacelift]: TSpaceliftConnectionOption;[AppConnection.Daytona]: TDaytonaConnectionOption;+ [AppConnection.ServiceNow]: TServiceNowConnectionOption;};diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.tsindex d9c87af033..81b23cf96a 100644--- a/frontend/src/hooks/api/appConnections/types/index.ts+++ b/frontend/src/hooks/api/appConnections/types/index.ts@@ -73,6 +73,7 @@ import { TRedisConnection } from "./redis-connection";import { TRenderConnection } from "./render-connection";import { TRundeckConnection } from "./rundeck-connection";import { TSalesforceConnection } from "./salesforce-connection";+import { TServiceNowConnection } from "./servicenow-connection";import { TSmbConnection } from "./smb-connection";import { TSnowflakeConnection } from "./snowflake-connection";import { TSpaceliftConnection } from "./spacelift-connection";@@ -161,6 +162,7 @@ export * from "./redis-connection";export * from "./render-connection";export * from "./rundeck-connection";export * from "./salesforce-connection";+export * from "./servicenow-connection";export * from "./smb-connection";export * from "./snowflake-connection";export * from "./spacelift-connection";@@ -269,7 +271,8 @@ export type TAppConnection =| TDaytonaConnection| TStripeConnection| TKeeperConnection- | THpeIloConnection;+ | THpeIloConnection+ | TServiceNowConnection;export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id" | "projectId">;diff --git a/frontend/src/hooks/api/appConnections/types/servicenow-connection.ts b/frontend/src/hooks/api/appConnections/types/servicenow-connection.tsnew file mode 100644index 0000000000..cd5bd7b319--- /dev/null+++ b/frontend/src/hooks/api/appConnections/types/servicenow-connection.ts@@ -0,0 +1,15 @@+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";++export enum ServiceNowConnectionMethod {+ BasicAuth = "basic-auth"+}++export type TServiceNowConnection = TRootAppConnection & { app: AppConnection.ServiceNow } & {+ method: ServiceNowConnectionMethod.BasicAuth;+ credentials: {+ instanceUrl: string;+ username: string;+ password: string;+ };+};diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsxindex 90d03afd94..1ee8e5584b 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx@@ -88,6 +88,7 @@ import { RedisConnectionForm } from "./RedisConnectionForm";import { RenderConnectionForm } from "./RenderConnectionForm";import { RundeckConnectionForm } from "./RundeckConnectionForm";import { SalesforceConnectionForm } from "./SalesforceConnectionForm";+import { ServiceNowConnectionForm } from "./ServiceNowConnectionForm";import { SmbConnectionForm } from "./SmbConnectionForm";import { SnowflakeConnectionForm } from "./SnowflakeConnectionForm";import { SpaceliftConnectionForm } from "./SpaceliftConnectionForm";@@ -334,6 +335,8 @@ const CreateForm = ({ app, onComplete, projectId, projectType }: CreateFormPropsreturn <DevinConnectionForm onSubmit={onSubmit} />;case AppConnection.Daytona:return <DaytonaConnectionForm onSubmit={onSubmit} />;+ case AppConnection.ServiceNow:+ return <ServiceNowConnectionForm onSubmit={onSubmit} />;case AppConnection.CircleCI:return <CircleCIConnectionForm onSubmit={onSubmit} />;case AppConnection.Cloud66:@@ -639,6 +642,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {return <DevinConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.Daytona:return <DaytonaConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;+ case AppConnection.ServiceNow:+ return <ServiceNowConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.CircleCI:return <CircleCIConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.Cloud66:diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/ServiceNowConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/ServiceNowConnectionForm.tsxnew file mode 100644index 0000000000..90aea293a8--- /dev/null+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/ServiceNowConnectionForm.tsx@@ -0,0 +1,184 @@+import { Controller, FormProvider, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { Info } from "lucide-react";+import { z } from "zod";++import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ SecretInput,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";+import { TServiceNowConnection } from "@app/hooks/api/appConnections";+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { ServiceNowConnectionMethod } from "@app/hooks/api/appConnections/types/servicenow-connection";++import { AppConnectionFormFooter } from "./AppConnectionFormFooter";+import {+ genericAppConnectionFieldsSchema,+ GenericAppConnectionsFields+} from "./GenericAppConnectionFields";++type Props = {+ appConnection?: TServiceNowConnection;+ onSubmit: (formData: FormData) => Promise<void>;+};++const rootSchema = genericAppConnectionFieldsSchema.extend({+ app: z.literal(AppConnection.ServiceNow)+});++const formSchema = z.discriminatedUnion("method", [+ rootSchema.extend({+ method: z.literal(ServiceNowConnectionMethod.BasicAuth),+ credentials: z.object({+ instanceUrl: z+ .string()+ .trim()+ .url("Invalid instance URL")+ .max(512, "Instance URL cannot exceed 512 characters")+ .refine((value) => value.startsWith("https://"), "Instance URL must use HTTPS")+ .refine((value) => {+ const { pathname, search, hash } = new URL(value);+ return (pathname === "" || pathname === "/") && !search && !hash;+ }, "Enter the base URL of your instance, without a path"),+ username: z+ .string()+ .trim()+ .min(1, "Username is required")+ .max(256, "Username cannot exceed 256 characters"),+ password: z+ .string()+ .trim()+ .min(1, "Password is required")+ .max(512, "Password cannot exceed 512 characters")+ })+ })+]);++type FormData = z.infer<typeof formSchema>;++export const ServiceNowConnectionForm = ({ appConnection, onSubmit }: Props) => {+ const isUpdate = Boolean(appConnection);++ const form = useForm<FormData>({+ resolver: zodResolver(formSchema),+ defaultValues: appConnection ?? {+ app: AppConnection.ServiceNow,+ method: ServiceNowConnectionMethod.BasicAuth,+ credentials: {+ instanceUrl: "",+ username: "",+ password: ""+ }+ }+ });++ const { handleSubmit, control } = form;++ return (+ <FormProvider {...form}>+ <form onSubmit={handleSubmit(onSubmit)}>+ {!isUpdate && <GenericAppConnectionsFields />}+ <Controller+ name="method"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Method+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ {`The method you would like to use to connect with ${+ APP_CONNECTION_MAP[AppConnection.ServiceNow].name+ }. This field cannot be changed after creation.`}+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Select disabled={isUpdate} value={value} onValueChange={(val) => onChange(val)}>+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select a method..." />+ </SelectTrigger>+ <SelectContent position="popper">+ {Object.values(ServiceNowConnectionMethod).map((method) => {+ return (+ <SelectItem value={method} key={method}>+ {getAppConnectionMethodDetails(method).name}+ </SelectItem>+ );+ })}+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ name="credentials.instanceUrl"+ control={control}+ shouldUnregister+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="instance-url">Instance URL</FieldLabel>+ <Input+ id="instance-url"+ {...field}+ placeholder="https://dev12345.service-now.com"+ isError={Boolean(error?.message)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <div className="grid grid-cols-2 gap-2">+ <Controller+ name="credentials.username"+ control={control}+ shouldUnregister+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="credentials-username">Username</FieldLabel>+ <Input+ id="credentials-username"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ placeholder="infisical.integration"+ isError={Boolean(error?.message)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ name="credentials.password"+ control={control}+ shouldUnregister+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>Password</FieldLabel>+ <SecretInput value={value} onChange={(e) => onChange(e.target.value)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </div>+ <AppConnectionFormFooter+ submitLabel={isUpdate ? "Update Credentials" : "Connect to ServiceNow"}+ />+ </form>+ </FormProvider>+ );+};