fix: harden whatsapp command auth
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { hasControlCommand } from "../../../auto-reply/command-detection.js";
|
||||
import { parseActivationCommand } from "../../../auto-reply/group-activation.js";
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import { normalizeE164 } from "../../../utils.js";
|
||||
import type { MentionConfig } from "../mentions.js";
|
||||
import { buildMentionConfig, debugMention, resolveOwnerList } from "../mentions.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { isStatusCommand, stripMentionsForCommand } from "./commands.js";
|
||||
import { stripMentionsForCommand } from "./commands.js";
|
||||
import { resolveGroupActivationFor, resolveGroupPolicyFor } from "./group-activation.js";
|
||||
import { noteGroupMember } from "./group-members.js";
|
||||
|
||||
@@ -59,8 +60,7 @@ export function applyGroupGating(params: {
|
||||
);
|
||||
const activationCommand = parseActivationCommand(commandBody);
|
||||
const owner = isOwnerSender(params.baseMentionConfig, params.msg);
|
||||
const statusCommand = isStatusCommand(commandBody);
|
||||
const shouldBypassMention = owner && (activationCommand.hasCommand || statusCommand);
|
||||
const shouldBypassMention = owner && hasControlCommand(commandBody, params.cfg);
|
||||
|
||||
if (activationCommand.hasCommand && !owner) {
|
||||
params.logVerbose(`Ignoring /activation from non-owner in group ${params.conversationId}`);
|
||||
|
||||
Reference in New Issue
Block a user