fix(agents): use null-prototype accumulator to prevent __proto__ pollution

Addresses cubic-dev-ai P1 review: Object.hasOwn() alone doesn't prevent
a crafted '__proto__' agent name from mutating the result object's
prototype chain. Using Object.create(null) eliminates inherited properties
entirely, making both the hasOwn checks and property assignments safe.
This commit is contained in:
Brandon Webb
2026-04-14 20:55:28 -04:00
committed by YeonGyu-Kim
parent cf4b231553
commit 4c77045c47
@@ -79,7 +79,7 @@ function convertInlineAgent(agentData: unknown): ClaudeCodeAgentConfig | null {
}
export function readOpencodeConfigAgents(directory: string): Record<string, ClaudeCodeAgentConfig> {
const result: Record<string, ClaudeCodeAgentConfig> = {}
const result: Record<string, ClaudeCodeAgentConfig> = Object.create(null)
for (const configPath of getConfigPaths(directory)) {
try {