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
feat: updated some condition
=48425012a71a
diff --git a/backend/src/ee/services/honey-token/honey-token-service.ts b/backend/src/ee/services/honey-token/honey-token-service.tsindex 6d7961afd7..71eb2d3922 100644--- a/backend/src/ee/services/honey-token/honey-token-service.ts+++ b/backend/src/ee/services/honey-token/honey-token-service.ts@@ -959,12 +959,12 @@ export const honeyTokenServiceFactory = ({}).find((accessKeyId): accessKeyId is string => Boolean(accessKeyId));if (!firstAccessKeyId) {- throw new UnauthorizedError({ message: "Could not infer honey token organization from payload" });+ throw new UnauthorizedError({ message: "Invalid webhook request" });}const honeyTokenWithOrg = await honeyTokenDAL.findOneByTokenIdentifier(firstAccessKeyId);if (!honeyTokenWithOrg) {- throw new UnauthorizedError({ message: "Could not infer honey token organization from payload" });+ throw new UnauthorizedError({ message: "Invalid webhook request" });}const config = await honeyTokenConfigDAL.findOne({@@ -973,7 +973,7 @@ export const honeyTokenServiceFactory = ({status: HoneyTokenConfigStatus.Complete});if (!config?.encryptedConfig) {- throw new NotFoundError({ message: "No honey token configuration found for this organization" });+ throw new UnauthorizedError({ message: "Invalid webhook request" });}const { decryptor } = await kmsService.createCipherPairWithDataKey({@@ -994,7 +994,7 @@ export const honeyTokenServiceFactory = ({expectedBuf.byteLength !== receivedBuf.byteLength ||!crypto.nativeCrypto.timingSafeEqual(expectedBuf, receivedBuf)) {- throw new UnauthorizedError({ message: "Invalid webhook signature" });+ throw new UnauthorizedError({ message: "Invalid webhook request" });}/* eslint-disable no-continue */diff --git a/backend/src/server/routes/v3/signup-router.ts b/backend/src/server/routes/v3/signup-router.tsindex fd9e4f8594..21f5badc42 100644--- a/backend/src/server/routes/v3/signup-router.ts+++ b/backend/src/server/routes/v3/signup-router.ts@@ -60,7 +60,8 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {method: "POST",config: {rateLimit: smtpRateLimit({- keyGenerator: (req) => (req.body as { email?: string })?.email?.trim().substring(0, 100) || req.realIp+ keyGenerator: (req) =>+ (req.body as { email?: string })?.email?.trim()?.toLowerCase().substring(0, 100) || req.realIp})},schema: {diff --git a/backend/src/services/additional-privilege/project/project-additional-privilege-factory.ts b/backend/src/services/additional-privilege/project/project-additional-privilege-factory.tsindex 6dedc7fddd..150e13390f 100644--- a/backend/src/services/additional-privilege/project/project-additional-privilege-factory.ts+++ b/backend/src/services/additional-privilege/project/project-additional-privilege-factory.ts@@ -385,7 +385,7 @@ export const newProjectAdditionalPrivilegesFactory = ({}}- if (shouldUseNewPrivilegeSystem && permissions) {+ if (permissions) {validateGrantPrivilegeSubjectActionConditions(shouldUseNewPrivilegeSystem,permissionAction,diff --git a/backend/src/services/auth-token/auth-token-service.ts b/backend/src/services/auth-token/auth-token-service.tsindex 7dd298e5f9..df49535c13 100644--- a/backend/src/services/auth-token/auth-token-service.ts+++ b/backend/src/services/auth-token/auth-token-service.ts@@ -33,7 +33,8 @@ export const getTokenConfig = (tokenType: TokenType) => {// generate random 6-digit codeconst token = String(crypto.randomInt(10 ** 5, 10 ** 6 - 1));const expiresAt = new Date(new Date().getTime() + 86400000);- return { token, expiresAt };+ const triesLeft = 3;+ return { token, expiresAt, triesLeft };}case TokenType.TOKEN_EMAIL_VERIFICATION: {// generate random 6-digit code@@ -149,7 +150,7 @@ export const tokenServiceFactory = ({ tokenDAL, userDAL, orgDAL, keyStore }: TAu}if (!isValidToken) {- if (token.triesLeft) {+ if (token.triesLeft !== undefined) {if (token.triesLeft === 1) {await tokenDAL.deleteTokenForUser({ type, userId, orgId: orgId || null });} else {diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.tsindex 22c9bdbd2b..5775cf4b55 100644--- a/backend/src/services/auth/auth-login-service.ts+++ b/backend/src/services/auth/auth-login-service.ts@@ -543,6 +543,14 @@ export const authLoginServiceFactory = ({throw new BadRequestError({ message: "Invalid credentials" });}+ const serverCfg = await getServerCfg();+ if (serverCfg.enabledLoginMethods && !serverCfg.enabledLoginMethods.includes(LoginMethod.EMAIL)) {+ const userOrgs = await orgDAL.findAllOrgsByUserId(user.id);+ if (!userOrgs.some((org) => org.userRole === OrgMembershipRole.Admin)) {+ throw new BadRequestError({ message: "Invalid credentials" });+ }+ }+await verifyCaptcha(user.consecutiveFailedPasswordAttempts, captchaToken);if (!(await crypto.hashing().compareHash(password, user.hashedPassword))) {diff --git a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.tsindex 6f7f45a23e..11de9d3ac1 100644--- a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts+++ b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts@@ -26,7 +26,7 @@ import {isPqcCryptoKey,PqcCryptoKey} from "@app/lib/crypto/pqc";-import { BadRequestError, NotFoundError } from "@app/lib/errors";+import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";import { ms } from "@app/lib/ms";import { alphaNumericNanoId } from "@app/lib/nanoid";import { ActorAuthMethod, ActorType } from "@app/services/auth/auth-type";@@ -1441,6 +1441,10 @@ export const internalCertificateAuthorityServiceFactory = ({const parentCa = await certificateAuthorityDAL.findByIdWithAssociatedCa(parentCaId, tx);if (!parentCa.internalCa) throw new NotFoundError({ message: `Parent CA with ID '${parentCaId}' not found` });+ if (intermediateCa.projectId !== parentCa.projectId) {+ throw new ForbiddenRequestError({ message: "Intermediate and Parent CA must belong to the same project" });+ }+const { permission } = await permissionService.getProjectPermission({actor,actorId,diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.tsindex 9b8bda9f65..e9fa082f9c 100644--- a/backend/src/services/project/project-service.ts+++ b/backend/src/services/project/project-service.ts@@ -2324,11 +2324,19 @@ export const projectServiceFactory = ({};const requestProjectAccess = async ({ permission, comment, projectId }: TProjectAccessRequestDTO) => {+ const project = await requestMemoize(requestMemoKeys.projectFindById(projectId), () =>+ projectDAL.findById(projectId)+ );+ if (!project) {+ throw new NotFoundError({+ message: `Project with ID ${projectId} not found`+ });+ }// check user belong to org and has permission to request project accessconst { permission: orgPermission } = await permissionService.getOrgPermission({actor: permission.type,actorId: permission.id,- orgId: permission.orgId,+ orgId: project.orgId,actorAuthMethod: permission.authMethod,actorOrgId: permission.orgId,scope: OrganizationActionScope.Any@@ -2400,9 +2408,6 @@ export const projectServiceFactory = ({}const org = await orgDAL.findOne({ id: permission.orgId });- const project = await requestMemoize(requestMemoKeys.projectFindById(projectId), () =>- projectDAL.findById(projectId)- );const userDetails = await userDAL.findById(permission.id);const appCfg = getConfig();