fix: trim whatsapp admission sender identity

This commit is contained in:
Shakker
2026-06-15 19:28:58 +01:00
committed by Shakker
parent ef6b7e3659
commit eb67ac5cbe
5 changed files with 2 additions and 12 deletions

View File

@@ -187,9 +187,7 @@ describe("checkInboundAccessControl admission contract", () => {
},
sender: {
id: "+15550001111",
dmSenderId: "+15550001111",
isSamePhone: false,
isDmSenderSamePhone: false,
},
ingress: {
admission: "dispatch",
@@ -255,7 +253,8 @@ describe("checkInboundAccessControl admission contract", () => {
groupSessionId: groupJid,
});
expect(result.admission.sender.id).toBe(participantJid);
expect(result.admission.sender.dmSenderId).toBe(groupJid);
expect(result.admission.sender).not.toHaveProperty("dmSenderId");
expect(result.admission.conversation.kind).toBe("group");
});
it("does not authorize unresolved group participant JIDs as phone allowlist entries", async () => {

View File

@@ -191,7 +191,6 @@ export async function checkInboundAccessControl(params: {
isGroup: params.group,
conversationId,
senderId: admissionSenderId,
dmSenderId: params.from,
}),
};
}

View File

@@ -60,9 +60,7 @@ export type WhatsAppInboundAdmission = {
};
sender: {
id: string;
dmSenderId: string;
isSamePhone: boolean;
isDmSenderSamePhone: boolean;
};
ingress: WhatsAppInboundIngressDecision;
senderAccess: WhatsAppInboundSenderAccess;
@@ -96,7 +94,6 @@ export function buildWhatsAppInboundAdmission(params: {
isGroup: boolean;
conversationId: string;
senderId: string;
dmSenderId: string;
}): WhatsAppInboundAdmission {
return {
accountId: params.policy.account.accountId,
@@ -109,9 +106,7 @@ export function buildWhatsAppInboundAdmission(params: {
},
sender: {
id: params.senderId,
dmSenderId: params.dmSenderId,
isSamePhone: params.policy.isSamePhone(params.senderId),
isDmSenderSamePhone: params.policy.isSamePhone(params.dmSenderId),
},
ingress: {
admission: params.access.ingress.admission,

View File

@@ -23,9 +23,7 @@ function createAdmission(): NonNullable<WebInboundCallbackMessage["admission"]>
},
sender: {
id: "+15550000002",
dmSenderId: "123@g.us",
isSamePhone: false,
isDmSenderSamePhone: false,
},
ingress: {
admission: "dispatch",

View File

@@ -233,7 +233,6 @@ describe("web monitor inbox", () => {
},
sender: {
id: "+999",
dmSenderId: "+999",
},
senderAccess: {
allowed: true,