mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 02:02:45 +00:00
refactor(security): enforce account-scoped pairing APIs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { loadSessionStore, resolveStorePath } from "../../config/sessions.js";
|
||||
import { readChannelAllowFromStoreSync } from "../../pairing/pairing-store.js";
|
||||
import { DEFAULT_ACCOUNT_ID } from "../../routing/session-key.js";
|
||||
import { normalizeE164 } from "../../utils.js";
|
||||
import { normalizeChatChannelId } from "../registry.js";
|
||||
|
||||
@@ -56,7 +57,11 @@ export function resolveWhatsAppHeartbeatRecipients(
|
||||
Array.isArray(cfg.channels?.whatsapp?.allowFrom) && cfg.channels.whatsapp.allowFrom.length > 0
|
||||
? cfg.channels.whatsapp.allowFrom.filter((v) => v !== "*").map(normalizeE164)
|
||||
: [];
|
||||
const storeAllowFrom = readChannelAllowFromStoreSync("whatsapp").map(normalizeE164);
|
||||
const storeAllowFrom = readChannelAllowFromStoreSync(
|
||||
"whatsapp",
|
||||
process.env,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
).map(normalizeE164);
|
||||
|
||||
const unique = (list: string[]) => [...new Set(list.filter(Boolean))];
|
||||
const allowFrom = unique([...configuredAllowFrom, ...storeAllowFrom]);
|
||||
|
||||
Reference in New Issue
Block a user