Skip to content

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

Fix: Allow query function to be called with undefined orgId, and handle it as an error

Daniel Hougaardf7122c21fd62
diff --git a/backend/src/services/project/project-dal.ts b/backend/src/services/project/project-dal.ts
index 369e005acc..4f4225344d 100644
--- a/backend/src/services/project/project-dal.ts
+++ b/backend/src/services/project/project-dal.ts
@@ -168,8 +168,12 @@ export const projectDALFactory = (db: TDbClient) => {
}
};
- const findProjectBySlug = async (slug: string, orgId: string) => {
+ const findProjectBySlug = async (slug: string, orgId: string | undefined) => {
try {
+ if (!orgId) {
+ throw new BadRequestError({ message: "Organization ID is required when querying with slugs" });
+ }
+
const projects = await db(TableName.ProjectMembership)
.where(`${TableName.Project}.slug`, slug)
.where(`${TableName.Project}.orgId`, orgId)