Skip to content

[#170] 배포#353

Merged
hdg0116 merged 2 commits intomainfrom
dev
Feb 12, 2026
Merged

[#170] 배포#353
hdg0116 merged 2 commits intomainfrom
dev

Conversation

@hdg0116
Copy link
Copy Markdown
Collaborator

@hdg0116 hdg0116 commented Feb 12, 2026

@hdg0116 hdg0116 self-assigned this Feb 12, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @hdg0116, 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은 특정 영상에 대한 모든 댓글을 조회하는 새로운 기능을 백엔드에 도입합니다. 이를 통해 사용자는 영상에 달린 모든 댓글을 한눈에 볼 수 있게 되며, 기존의 타임스탬프 기반 댓글 조회 외에 더 포괄적인 댓글 접근 방식을 제공합니다. 새로운 API 엔드포인트, 관련 서비스 및 레포지토리 로직, 그리고 상세한 API 문서가 포함되어 기능의 완전성을 보장합니다.

Highlights

  • 새로운 API 엔드포인트 추가: 특정 영상의 모든 댓글을 조회하는 /videos/{videoId}/comments/all 엔드포인트가 추가되었습니다.
  • 영상 댓글 전체 조회 기능 구현: 비디오 ID를 기반으로 모든 댓글을 데이터베이스에서 가져오고, 유효성 검사를 수행하는 서비스 및 레포지토리 로직이 구현되었습니다.
  • Swagger 문서 업데이트: 새로 추가된 API 엔드포인트에 대한 상세한 Swagger 문서가 추가되어 API 사용법과 응답 형식을 명확히 설명합니다.
Changelog
  • src/controllers/comment.controller.js
    • getShareCommentsResponseDTOgetAllVideoComments 임포트가 추가되었습니다.
    • getAllVideoCommentsController 함수 및 관련 Swagger 문서가 추가되었습니다.
    • VideoAllCommentItemVideoAllCommentsResponse Swagger 스키마 정의가 추가되었습니다.
  • src/dtos/shareLink.dto.js
    • shareCommentItemDTO 함수가 export 가능하도록 수정되었습니다.
  • src/repositories/comment.repository.js
    • findAllVideoComments 함수가 추가되었습니다.
  • src/routes/comment.route.js
    • getAllVideoCommentsController 임포트가 추가되었습니다.
    • /videos/:videoId/comments/all GET 라우트가 추가되었습니다.
  • src/services/comment.service.js
    • findAllVideoComments 임포트가 추가되었습니다.
    • getAllVideoComments 서비스 함수가 추가되었습니다.
Activity
  • 이 PR에 대한 활동 내역이 제공되지 않았습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@hdg0116 hdg0116 merged commit 771569d into main Feb 12, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR introduces an API to retrieve all comments for a video. However, it introduces a high-severity Broken Access Control (IDOR) vulnerability because the implementation lacks proper authorization checks for the new endpoint /videos/:videoId/comments/all. While authentication is required, it doesn't verify if the user is authorized to view the comments. Additionally, there are opportunities to improve code clarity and reduce duplication, specifically regarding videoId validation in comment.service.js and the naming/location of DTOs in comment.controller.js. Minor adjustments for Swagger documentation consistency are also noted.

Comment on lines +212 to +230
export const getAllVideoComments = async ({ videoId }) => {
let vid;
try {
vid = BigInt(videoId);
} catch {
throw new InvalidParameterError({ videoId }, "videoId가 올바르지 않습니다.");
}

if (vid <= 0n) {
throw new InvalidParameterError({ videoId }, "videoId가 올바르지 않습니다.");
}

const videoExists = await findVideoByIdWithProject(vid);
if (!videoExists) {
throw new VideoNotFoundError({ videoId: String(videoId) });
}

return findAllVideoComments({ videoId: vid });
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

This section of the getAllVideoComments service lacks a crucial authorization check. While it verifies video existence, it fails to confirm if the requesting user has permission to view the comments for the given videoId. This creates a high-severity Broken Access Control (IDOR) vulnerability, allowing any authenticated user to retrieve comments for any video. To fix this, you should pass the userId from the controller and verify ownership or access rights, similar to how getSlideComments is implemented. Additionally, the logic for parsing and validating videoId (lines 213-222) and checking video existence (lines 224-227) is duplicated across functions like createVideoComment and getVideoCommentsByTimestamp. Extracting this into a reusable helper function, such as validateAndFindVideo(videoId), would improve consistency and maintainability.

Comment on lines +945 to +947
const { videoId } = req.params;

const comments = await getAllVideoComments({ videoId });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

The getAllVideoCommentsController does not pass the authenticated user's ID to the service layer for authorization. This contributes to an Insecure Direct Object Reference (IDOR) vulnerability where any logged-in user can access comments for any video.

Comment on lines +913 to +920
* unauthorized:
* value:
* resultType: FAILURE
* error:
* errorCode: A004
* reason: 인증 세션 정보가 없거나 유효하지 않습니다.
* data: null
* success: null
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Swagger 문서에서 401 오류 응답 예시의 resultTypeerrorCode 값이 다른 오류 예시들과 형식이 일치하지 않습니다. 스키마 정의 및 다른 예시와 일관성을 맞추기 위해 문자열로 (따옴표로 감싸서) 수정하는 것이 좋겠습니다.

Suggested change
* unauthorized:
* value:
* resultType: FAILURE
* error:
* errorCode: A004
* reason: 인증 세션 정보가 없거나 유효하지 않습니다.
* data: null
* success: null
unauthorized:
value:
resultType: "FAILURE"
error:
errorCode: "A004"
reason: 인증 세션 정보가 없거나 유효하지 않습니다.
data: null
success: null

res.status(200).json({
resultType: "SUCCESS",
error: null,
success: getShareCommentsResponseDTO({
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

getShareCommentsResponseDTO 함수가 사용되고 있습니다. 이 함수의 기능은 적합하지만, 이름과 shareLink.dto.js라는 위치는 공유 기능에 특화된 것으로 보입니다. 일반적인 댓글 조회 엔드포인트에서 이 함수를 사용하면 향후 유지보수 시 혼란을 줄 수 있습니다. getShareCommentsResponseDTOshareCommentItemDTOcomment.dto.js와 같은 보다 일반적인 DTO 파일로 옮기고, formatCommentsForResponseDTO처럼 범용적인 이름으로 변경하는 것을 고려해 보세요. 이렇게 하면 코드의 명확성과 구조가 개선될 것입니다.

@hdg0116 hdg0116 changed the title [Deploy][조이] 배포 [#170] 배포 Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant