fix(agents): reject bind specs with extra colon segments

This commit is contained in:
openclaw-clownfish[bot]
2026-06-22 03:02:39 +00:00
parent 90061fb8ff
commit 3e1af31fc4
+7 -7
View File
@@ -316,20 +316,20 @@ export function parseBindingSpecs(params: {
if (!trimmed) {
continue;
}
// Account ids never contain ":" (VALID_ID_RE in routing/account-id), so split fully: a third
// segment is a malformed spec, not an account id to silently truncate to (split(":", 2) drops it).
// Bind specs are exactly <channel> or <channel>:<account>; extra colon
// segments would silently change the requested account if truncated.
const [channelRaw, accountRaw, ...extraSegments] = trimmed.split(":");
const channel = normalizeBindingChannelId(channelRaw, params.config);
if (!channel) {
errors.push(formatUnknownChannelMessage({ channel: channelRaw }));
continue;
}
if (extraSegments.length > 0) {
errors.push(
`Invalid binding "${trimmed}". Account id cannot contain ":". Use <channel>:<account>, for example telegram:default.`,
);
continue;
}
const channel = normalizeBindingChannelId(channelRaw, params.config);
if (!channel) {
errors.push(formatUnknownChannelMessage({ channel: channelRaw }));
continue;
}
let accountId: string | undefined = accountRaw?.trim();
if (accountRaw !== undefined && !accountId) {
errors.push(