mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 08:21:11 +00:00
fix(security): harden account-key handling against prototype pollution
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { normalizeChannelId } from "../channels/plugins/index.js";
|
||||
import { resolveAccountEntry } from "../routing/account-lookup.js";
|
||||
import { normalizeAccountId } from "../routing/session-key.js";
|
||||
import type { OpenClawConfig } from "./config.js";
|
||||
import type { MarkdownTableMode } from "./types.base.js";
|
||||
@@ -31,15 +32,7 @@ function resolveMarkdownModeFromSection(
|
||||
const normalizedAccountId = normalizeAccountId(accountId);
|
||||
const accounts = section.accounts;
|
||||
if (accounts && typeof accounts === "object") {
|
||||
const direct = accounts[normalizedAccountId];
|
||||
const directMode = direct?.markdown?.tables;
|
||||
if (isMarkdownTableMode(directMode)) {
|
||||
return directMode;
|
||||
}
|
||||
const matchKey = Object.keys(accounts).find(
|
||||
(key) => key.toLowerCase() === normalizedAccountId.toLowerCase(),
|
||||
);
|
||||
const match = matchKey ? accounts[matchKey] : undefined;
|
||||
const match = resolveAccountEntry(accounts, normalizedAccountId);
|
||||
const matchMode = match?.markdown?.tables;
|
||||
if (isMarkdownTableMode(matchMode)) {
|
||||
return matchMode;
|
||||
|
||||
Reference in New Issue
Block a user