fix: enforce team scoping for campaign, contacts, and invites (#356)

* fix: enforce team-scoped lookups for campaign contacts and invites

* fix(test): mock domain service in campaign security test
This commit is contained in:
KM Koushik
2026-02-23 11:30:05 +11:00
committed by GitHub
parent f7a0d11758
commit 61dfcee67d
8 changed files with 319 additions and 15 deletions
@@ -52,13 +52,14 @@ function getContact(app: PublicAPIApp) {
app.openapi(route, async (c) => {
const team = c.var.team;
await getContactBook(c, team.id);
const contactBook = await getContactBook(c, team.id);
const contactId = c.req.param("contactId");
const contact = await db.contact.findUnique({
const contact = await db.contact.findFirst({
where: {
id: contactId,
contactBookId: contactBook.id,
},
});