mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 00:13:28 +00:00
fix(security): harden account-key handling against prototype pollution
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { resolveAccountEntry } from "../../routing/account-lookup.js";
|
||||
import { normalizeAccountId } from "../../routing/session-key.js";
|
||||
import type { ChannelId } from "./types.js";
|
||||
|
||||
@@ -8,16 +9,7 @@ type ChannelConfigWithAccounts = {
|
||||
};
|
||||
|
||||
function resolveAccountConfig(accounts: ChannelConfigWithAccounts["accounts"], accountId: string) {
|
||||
if (!accounts || typeof accounts !== "object") {
|
||||
return undefined;
|
||||
}
|
||||
if (accountId in accounts) {
|
||||
return accounts[accountId];
|
||||
}
|
||||
const matchKey = Object.keys(accounts).find(
|
||||
(key) => key.toLowerCase() === accountId.toLowerCase(),
|
||||
);
|
||||
return matchKey ? accounts[matchKey] : undefined;
|
||||
return resolveAccountEntry(accounts, accountId);
|
||||
}
|
||||
|
||||
export function resolveChannelConfigWrites(params: {
|
||||
|
||||
Reference in New Issue
Block a user