From 8d3fec08e59b100da036b685d20b080203ba3a4c Mon Sep 17 00:00:00 2001 From: moon jooho Date: Fri, 4 Jul 2025 09:13:02 +0900 Subject: Add and improve JSDoc comments for core tool methods (#3128) --- packages/core/src/tools/write-file.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'packages/core/src/tools/write-file.ts') diff --git a/packages/core/src/tools/write-file.ts b/packages/core/src/tools/write-file.ts index 2d5e85be..c343cab8 100644 --- a/packages/core/src/tools/write-file.ts +++ b/packages/core/src/tools/write-file.ts @@ -96,6 +96,13 @@ export class WriteFileTool this.client = this.config.getGeminiClient(); } + /** + * Checks if a given path is within the root directory bounds. + * This security check prevents writing files outside the designated root directory. + * + * @param pathToCheck The absolute path to validate + * @returns True if the path is within the root directory, false otherwise + */ private isWithinRoot(pathToCheck: string): boolean { const normalizedPath = path.normalize(pathToCheck); const normalizedRoot = path.normalize(this.config.getTargetDir()); -- cgit v1.2.3