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:
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> {
|
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)) {
|
for (const configPath of getConfigPaths(directory)) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user