mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-29 22:13:37 +00:00
fix: trim whatsapp admission sender identity
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -191,7 +191,6 @@ export async function checkInboundAccessControl(params: {
|
||||
isGroup: params.group,
|
||||
conversationId,
|
||||
senderId: admissionSenderId,
|
||||
dmSenderId: params.from,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -23,9 +23,7 @@ function createAdmission(): NonNullable<WebInboundCallbackMessage["admission"]>
|
||||
},
|
||||
sender: {
|
||||
id: "+15550000002",
|
||||
dmSenderId: "123@g.us",
|
||||
isSamePhone: false,
|
||||
isDmSenderSamePhone: false,
|
||||
},
|
||||
ingress: {
|
||||
admission: "dispatch",
|
||||
|
||||
@@ -233,7 +233,6 @@ describe("web monitor inbox", () => {
|
||||
},
|
||||
sender: {
|
||||
id: "+999",
|
||||
dmSenderId: "+999",
|
||||
},
|
||||
senderAccess: {
|
||||
allowed: true,
|
||||
|
||||
Reference in New Issue
Block a user