From 1adcfffca964b6b781a8c776ef9b15e4b49a65a6 Mon Sep 17 00:00:00 2001 From: softdaddy-o Date: Tue, 6 Jan 2026 10:22:06 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Windows=20=EA=B2=BD=EB=A1=9C=20=EA=B5=AC?= =?UTF-8?q?=EB=B6=84=EC=9E=90=20=ED=98=B8=ED=99=98=EC=84=B1=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit validatePath()에서 '/' 대신 path.sep을 사용하여 Windows와 Unix 모두에서 정상 동작하도록 수정. Windows에서 resolve()는 백슬래시(\)를 반환하는데, 기존 코드는 슬래시(/)만 체크하여 모든 경로 검증이 실패했음. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/graph.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/graph.ts b/src/graph.ts index 3546f5e..8da2359 100644 --- a/src/graph.ts +++ b/src/graph.ts @@ -4,7 +4,7 @@ */ import { readdir, readFile, writeFile, unlink, mkdir, stat, lstat } from 'node:fs/promises'; -import { join, basename, extname, resolve } from 'node:path'; +import { join, basename, extname, resolve, sep } from 'node:path'; import type { Page, PageMetadata, SearchResult, SearchMatch, Graph, GraphNode, GraphEdge } from './types.js'; // 보안 상수 @@ -569,7 +569,8 @@ export class GraphService { const normalizedPath = resolve(filePath); const normalizedGraphPath = resolve(this.graphPath); - if (!normalizedPath.startsWith(normalizedGraphPath + '/') && normalizedPath !== normalizedGraphPath) { + // Windows/Unix 호환: path.sep 사용 ('/' 또는 '\') + if (!normalizedPath.startsWith(normalizedGraphPath + sep) && normalizedPath !== normalizedGraphPath) { throw new Error(`Access denied: path outside graph directory`); }