mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
fix(agents): reject bind specs with extra colon segments
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user