🛡️ Sentinel: [CRITICAL] Fix Path Traversal in exportGherkin#56
🛡️ Sentinel: [CRITICAL] Fix Path Traversal in exportGherkin#56seonghobae wants to merge 1 commit into
Conversation
- `exportGherkin` 명령어 실행 시 `args.output` 경로에 대한 보안 검증이 누락되어 있어, 사용자가 의도적으로 `../../` 와 같은 디렉토리 순회 문자열을 입력하면 프로젝트 루트 외부 영역에 파일을 쓸 수 있는 중대한 Path Traversal 취약점이 존재했습니다. - 이를 해결하기 위해 `node:path` 모듈의 `resolve`, `relative`, `isAbsolute` 함수를 활용하여, 최종 결정된 절대 경로가 `config.root` (프로젝트 루트) 내부에 존재하는지를 엄격하게 검사하는 방어 로직을 추가하였습니다. - 경로가 외부에 위치할 경우(`..` 로 시작하거나 루트 밖의 절대 경로인 경우), 정보를 유출하지 않고 `VspecError` 예외를 즉시 던지도록 설계하였습니다. - 관련된 보안 단위 테스트를 `tests/gherkin.test.ts`에 추가하여, 루트를 벗어나는 악의적인 경로 접근이 정확하게 차단되는 것을 증명하였습니다.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning Review limit reached
More reviews will be available in 48 minutes and 47 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚨 Severity: CRITICAL
💡 Vulnerability:
exportGherkin명령어는 출력할 파일 경로(args.output)를 사용자로부터 전달받아 파일을 작성합니다. 이때 입력된 경로가 프로젝트 디렉토리를 이탈하는지 여부를 검증하는 로직이 없었습니다.🎯 Impact: 이를 악용하면
../../../../etc/passwd나 윈도우 환경의 임의의 경로 등에 Gherkin Feature 파일 포맷으로 악의적인 파일을 덮어쓰거나 무단으로 생성할 수 있는 Path Traversal 취약점이 발생할 수 있었습니다.🔧 Fix:
outputPath의 절대 경로를 계산(path.resolve)한 뒤, 해당 경로가 프로젝트의 루트(config.root)의 상대 경로 상에서..로 시작하거나, 그 자체로 루트 외부를 가리키는 절대 경로일 경우VspecError를 발생시키며 즉시 차단하도록 방어 로직을 삽입했습니다.✅ Verification:
npx vitest run tests/gherkin.test.ts혹은pnpm test명령어를 통해 보안 검증 로직이 경로 순회 시도를 정확히 차단하고 예외를 발생시키는지 단위 테스트로 증명하였습니다.PR created automatically by Jules for task 17345951931432868628 started by @seonghobae