Chore: 전역 ValidationPipe 및 예외 응답 처리 표준화 (#73)#87
Conversation
Summary of ChangesHello @IISweetHeartII, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 전역 ValidationPipe를 활성화하고 유효성 검사 실패 응답을 GlobalExceptionFilter의 공통 에러 응답 형식에 맞춰 표준화하여 API의 견고성과 일관성을 향상시키는 것을 목표로 합니다. 이를 통해 클라이언트에게 보다 예측 가능한 에러 응답을 제공하고, 개발자가 유효성 검사 로직을 더 쉽게 관리할 수 있도록 지원합니다. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This PR introduces a global ValidationPipe to standardize validation failure responses, which is a good step towards improving data validation. However, a medium-severity Reflected XSS vulnerability has been identified in the new error handling logic, where validation error messages are directly reflected in the JSON response. Additionally, the approach of adding separate logic to GlobalExceptionFilter for NestJS built-in exceptions increases filter complexity and violates the style guide, which recommends using BusinessException instead. It's crucial to address the XSS vulnerability by sanitizing error messages and refactor the exception handling to use BusinessException for better maintainability and adherence to style guidelines.
Summary
전역 ValidationPipe를 활성화하고 Validation 실패 응답을 GlobalExceptionFilter 공통 포맷과 정합되게 표준화했습니다.
Changes
main.ts에 전역ValidationPipe적용 (whitelist,forbidNonWhitelisted,transform)GlobalExceptionFilter에 Validation 에러 분기(COMMON400) 처리 추가ParseIntPipe적용해 숫자 파라미터 검증 표준화docs/development/ERROR_HANDLING.md에 ValidationPipe 운영 규칙 및 응답 예시 문서화Type of Change
Target Environment
dev)main)Related Issues
Testing
실행 결과:
pnpm run lint: 통과pnpm run build: 통과 (TSC 0 issues)pnpm exec jest --passWithNoTests: No tests found, code 0Checklist
docs/development/CODE_STYLE.md)docs/development/GIT_CONVENTIONS.md)docs/development/NAMING_CONVENTIONS.md)pnpm run build)pnpm run lint)Screenshots (Optional)
N/A
Additional Notes
ParseIntPipe를 적용했습니다.CommonResponse.fail()포맷으로 일관 처리됩니다.