Skip to content

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

requested changes

Daniel Hougaard2a1bdfc407b2
diff --git a/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-service.ts b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-service.ts
index 61eb0c1703..b9e15720fd 100644
--- a/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-service.ts
+++ b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-service.ts
@@ -1,3 +1,5 @@
+import RE2 from "re2";
+
import { request } from "@app/lib/config/request";
import { OrgServiceActor } from "@app/lib/types";
import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";
@@ -39,7 +41,7 @@ const SCIM_SERVICE_PRINCIPALS_LIMIT = 5;
export const azureEntraIdConnectionService = (
getAppConnection: TGetAppConnectionFunc,
- appConnectionDAL: Pick<TAppConnectionDALFactory, "findById" | "update" | "updateById">,
+ appConnectionDAL: Pick<TAppConnectionDALFactory, "findById" | "updateById">,
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">
) => {
const listScimServicePrincipals = async (connectionId: string, actor: OrgServiceActor, search?: string) => {
@@ -55,7 +57,10 @@ export const azureEntraIdConnectionService = (
let url = `https://graph.microsoft.com/v1.0/servicePrincipals?$top=${SCIM_SERVICE_PRINCIPALS_LIMIT}&$select=id,displayName,appId`;
if (search) {
- url += `&$filter=startswith(displayName,'${encodeURIComponent(search)}')`;
+ const sanitizedSearch = search.replace(new RE2(/[^a-zA-Z0-9 -]/g), "");
+ if (sanitizedSearch) {
+ url += `&$filter=startswith(displayName,'${sanitizedSearch}')`;
+ }
}
const { data }: { data: TAzureServicePrincipalsResponse } = await request.get(url, { headers });
diff --git a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts
index 734fe44449..13d1b2026b 100644
--- a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts
+++ b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts
@@ -15,6 +15,7 @@ import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
const AzureEntraIdScimSyncDestinationConfigSchema = z.object({
servicePrincipalId: z
.string()
+ .uuid()
.trim()
.min(1, "Service Principal ID required")
.describe(SecretSyncs.DESTINATION_CONFIG.AZURE_ENTRA_ID_SCIM.servicePrincipalId),