remove api-key-org association for root keys

This commit is contained in:
miloschwartz
2025-08-01 15:55:47 -07:00
parent 6d359b6bb9
commit 7402590f49
11 changed files with 47 additions and 26 deletions

View File

@@ -1,9 +1,6 @@
import { Request, Response, NextFunction } from "express";
import { db } from "@server/db";
import {
sites,
apiKeyOrg
} from "@server/db";
import { sites, apiKeyOrg } from "@server/db";
import { and, eq, or } from "drizzle-orm";
import createHttpError from "http-errors";
import HttpCode from "@server/types/HttpCode";
@@ -31,6 +28,11 @@ export async function verifyApiKeySiteAccess(
);
}
if (apiKey.isRoot) {
// Root keys can access any key in any org
return next();
}
const site = await db
.select()
.from(sites)