Disallow Object.create() and reflect. (#22408)

This commit is contained in:
Christian Gunderman
2026-03-16 16:24:27 +00:00
committed by GitHub
parent e3df87cf1a
commit ef5627eece
9 changed files with 229 additions and 66 deletions
+3 -3
View File
@@ -243,10 +243,10 @@ export class GeminiCliSession {
const loopContext: AgentLoopContext = this.config;
const originalRegistry = loopContext.toolRegistry;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const scopedRegistry: ToolRegistry = Object.create(originalRegistry);
const scopedRegistry: ToolRegistry = originalRegistry.clone();
const originalGetTool = scopedRegistry.getTool.bind(scopedRegistry);
scopedRegistry.getTool = (name: string) => {
const tool = originalRegistry.getTool(name);
const tool = originalGetTool(name);
if (tool instanceof SdkTool) {
return tool.bindContext(context);
}