Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(auth): keep group join requests and invite links closed
Yudhi Armyndharisd81d186be8d1
diff --git a/src/modules/auth/chat-scope-coverage.spec.ts b/src/modules/auth/chat-scope-coverage.spec.tsindex 386257823..9d85ce694 100644--- a/src/modules/auth/chat-scope-coverage.spec.ts+++ b/src/modules/auth/chat-scope-coverage.spec.ts@@ -61,6 +61,15 @@ export const MUST_STAY_UNMARKED: ReadonlyArray<readonly [string, string]> = [['group.controller.ts', 'removeParticipants'],['group.controller.ts', 'promoteParticipants'],['group.controller.ts', 'demoteParticipants'],+ // A join request comes from a number outside the key's chats: listing the queue names them, and+ // approving or rejecting decides whether they join, the same membership change refused above.+ ['group.controller.ts', 'getMembershipRequests'],+ ['group.controller.ts', 'approveMembershipRequests'],+ ['group.controller.ts', 'rejectMembershipRequests'],+ // An invite link admits anyone who holds it, no request to decide, and keeps working after the key+ // is revoked; revoking returns a fresh link, so both routes hand the key the same capability.+ ['group.controller.ts', 'getInviteCode'],+ ['group.controller.ts', 'revokeInviteCode'],// A batch row has no key owner, so its status and cancel cannot be checked against an allowlist.['message.controller.ts', 'getBatchStatus'],['message.controller.ts', 'cancelBatch'],diff --git a/src/modules/group/group.controller.ts b/src/modules/group/group.controller.tsindex e57a83b59..71ce73118 100644--- a/src/modules/group/group.controller.ts+++ b/src/modules/group/group.controller.ts@@ -293,7 +293,6 @@ export class GroupController {return { success: true, message: 'Participants demoted from admin', results };}- @ChatScoped('fenced')@Get(':groupId/membership-requests')@ApiOperation({summary: 'List pending join requests for a group',@@ -313,7 +312,6 @@ export class GroupController {return this.groupService.getGroupMembershipRequests(sessionId, groupId);}- @ChatScoped('fenced')@Post(':groupId/membership-requests/approve')@RequireRole(ApiKeyRole.OPERATOR)@HttpCode(HttpStatus.OK)@@ -347,7 +345,6 @@ export class GroupController {return { success: true, message: 'Membership requests approved', results };}- @ChatScoped('fenced')@Post(':groupId/membership-requests/reject')@RequireRole(ApiKeyRole.OPERATOR)@HttpCode(HttpStatus.OK)@@ -535,7 +532,6 @@ export class GroupController {// The invite code is a bearer join capability, not read data: it works outside OpenWA and keeps// working after the key that fetched it is revoked. OPERATOR, like the QR endpoint.- @ChatScoped('fenced')@Get(':groupId/invite-code')@RequireRole(ApiKeyRole.OPERATOR)@ApiOperation({ summary: 'Get group invite code/link' })@@ -554,7 +550,6 @@ export class GroupController {};}- @ChatScoped('fenced')@Post(':groupId/invite-code/revoke')@RequireRole(ApiKeyRole.OPERATOR)@HttpCode(HttpStatus.OK)