Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(belief): build the link transition subject without Object.assign (semgrep insecure-object-assign)
garrytanaea19ec48ea1
diff --git a/src/core/belief/changes.ts b/src/core/belief/changes.tsindex 7e447ce0e4..aa8a21afda 100644--- a/src/core/belief/changes.ts+++ b/src/core/belief/changes.ts@@ -131,8 +131,7 @@ function subjectOf(kind: BeliefChangeKind, key: string, label: Record<string, unconst parsed = JSON.parse(key) as unknown[];const link = (kind === 'link_transition' ? parsed[1] : parsed) as unknown[];const out: Record<string, unknown> = { link_type: link[3], from: slugOf(label.from), to: slugOf(label.to) };- if (kind === 'link_transition') Object.assign(out, { transition: parsed[2], date: parsed[3], producer: parsed[4] });- return out;+ return kind === 'link_transition' ? { ...out, transition: parsed[2], date: parsed[3], producer: parsed[4] } : out;}function causeOf(e: BeliefHistoryRow): BeliefChange['cause'] {