feat(api): protect group dm changes (#1244)

This commit is contained in:
Hampus authored and GitHub committed 2026-07-01 21:55:59 +02:00
1 parent 6fd7c027e3
commit 33d05f9763
7 files changed
+210 -5

No files matched your search

@@ -21,6 +21,7 @@ import {z} from 'zod';
import {requireSudoMode} from '../../auth/services/SudoVerificationService';
import {createChannelID, createUserID} from '../../BrandedTypes';
import {DefaultUserOnly, LoginRequired} from '../../middleware/AuthMiddleware';
import {GroupDmRecipientAddProtectionMiddleware} from '../../middleware/GroupDmProtectionMiddleware';
import {RateLimitMiddleware} from '../../middleware/RateLimitMiddleware';
import {OpenAPI} from '../../middleware/ResponseTypeMiddleware';
import {SudoModeMiddleware} from '../../middleware/SudoModeMiddleware';
@@ -208,11 +209,12 @@ export function ChannelController(app: HonoApp) {
RateLimitMiddleware(RateLimitConfigs.CHANNEL_UPDATE),
LoginRequired,
Validator('param', ChannelIdUserIdParam),
GroupDmRecipientAddProtectionMiddleware,
OpenAPI({
operationId: 'add_group_dm_recipient',
summary: 'Add recipient to group DM',
description:
'Adds a user to a group direct message channel. The requesting user must be a member of the group DM.',
'Adds a user to a group direct message channel. The requesting user must be a member of the group DM. Requires CAPTCHA verification.',
responseSchema: null,
statusCode: 204,
security: ['botToken', 'bearerToken', 'sessionToken'],