Skip to content

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

feat: improvements in checks

=d4058da1b007
diff --git a/backend/src/ee/services/dynamic-secret/providers/ldap.ts b/backend/src/ee/services/dynamic-secret/providers/ldap.ts
index cd45460502..7f2312c8d3 100644
--- a/backend/src/ee/services/dynamic-secret/providers/ldap.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/ldap.ts
@@ -11,6 +11,7 @@ import { sanitizeString } from "@app/lib/fn";
import { validateHandlebarTemplate } from "@app/lib/template/validate-handlebars";
import { ActorIdentityAttributes } from "../../dynamic-secret-lease/dynamic-secret-lease-types";
+import { verifyHostInputValidity } from "../dynamic-secret-fns";
import { LdapCredentialType, LdapSchema, TDynamicProviderFns } from "./models";
import { generateUsername } from "./templateUtils";
@@ -73,6 +74,19 @@ export const LdapProvider = (): TDynamicProviderFns => {
};
const $getClient = async (providerInputs: z.infer<typeof LdapSchema>): Promise<ldapjs.Client> => {
+ let ldapHost: string;
+ try {
+ ldapHost = new URL(providerInputs.url).hostname;
+ } catch {
+ throw new BadRequestError({
+ message: "Invalid LDAP URL. Expected ldap:// or ldaps:// with a parseable host."
+ });
+ }
+ if (!ldapHost) {
+ throw new BadRequestError({ message: "Invalid LDAP URL. Missing host." });
+ }
+ await verifyHostInputValidity({ host: ldapHost, isDynamicSecret: true });
+
return new Promise((resolve, reject) => {
const client = ldapjs.createClient({
url: providerInputs.url,
diff --git a/backend/src/services/identity-token-auth/identity-token-auth-service.ts b/backend/src/services/identity-token-auth/identity-token-auth-service.ts
index ec71a9c3f1..57a6030eff 100644
--- a/backend/src/services/identity-token-auth/identity-token-auth-service.ts
+++ b/backend/src/services/identity-token-auth/identity-token-auth-service.ts
@@ -452,6 +452,9 @@ export const identityTokenAuthServiceFactory = ({
identityId
});
if (!identityMembershipOrg) throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+ if (identityMembershipOrg.identity.orgId !== actorOrgId) {
+ throw new ForbiddenRequestError({ message: "Sub organization not authorized to access this identity" });
+ }
if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.TOKEN_AUTH)) {
throw new BadRequestError({
diff --git a/backend/src/services/secret-import/secret-import-service.ts b/backend/src/services/secret-import/secret-import-service.ts
index c0bc9ff874..21cea2a7bc 100644
--- a/backend/src/services/secret-import/secret-import-service.ts
+++ b/backend/src/services/secret-import/secret-import-service.ts
@@ -248,6 +248,15 @@ export const secretImportServiceFactory = ({
});
}
+ // check if user has permission to import from target path when source is changing
+ if (data.environment || data.path) {
+ const newSourcePath = data.path || secImpDoc.importPath;
+ throwIfMissingSecretReadValueOrDescribePermission(permission, ProjectPermissionSecretActions.DescribeSecret, {
+ environment: importedEnv.slug,
+ secretPath: newSourcePath
+ });
+ }
+
const sourceFolder = await folderDAL.findBySecretPath(
projectId,
importedEnv.slug,