Conversation
Updated the README to clarify features and services offered by Singcode, including song list management and new attendance check and song recommendation features.
Feat/guest feature
Feat/footer navbar
Chore/docs
chore : 버전 2.1.0
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Review Summary by QodoVersion 2.1.0 - Guest tosing feature and footer animations
WalkthroughsDescription• Guest users can now add songs to "tosing" list without authentication • Footer navigation includes animated highlight effects on user interactions • Added guest data persistence using localStorage for tosing functionality • Improved query management with conditional authentication checks • Added issue templates and development documentation Diagramflowchart LR
A["Guest User"] -->|"Add Song"| B["useGuestToSingStore"]
B -->|"Persist to localStorage"| C["Local Storage"]
C -->|"Retrieve on Load"| D["ToSing Page"]
E["User Action"] -->|"Trigger"| F["useFooterAnimateStore"]
F -->|"Set Animation Key"| G["Footer Component"]
G -->|"Framer Motion"| H["Animated Highlight"]
File Changes1. apps/web/src/app/api/songs/tosing/guest/route.ts
|
Code Review by Qodo
1. API returns error.message
|
| if (error) { | ||
| return NextResponse.json( | ||
| { | ||
| success: false, | ||
| error: error?.message || 'Unknown error', | ||
| }, | ||
| { status: 500 }, | ||
| ); |
There was a problem hiding this comment.
1. Api returns error.message 📘 Rule violation ⛨ Security
• /api/songs/tosing/guest에서 Supabase 오류의 error.message를 그대로 응답으로 반환하고 있습니다. • DB/내부 구현 관련 오류 메시지가 사용자에게 노출될 수 있어, 공격자에게 시스템 정보를 제공할 위험이 있습니다. • 사용자-facing 응답은 일반화하고, 상세 오류는 내부 로그로만 남겨야 합니다.
Agent Prompt
## Issue description
`/api/songs/tosing/guest`가 Supabase의 `error.message`를 그대로 사용자에게 반환하여 내부 정보가 노출될 수 있습니다.
## Issue Context
컴플라이언스(secure error handling)는 사용자-facing 오류 응답에 내부 구현/DB 상세를 포함하지 말 것을 요구합니다.
## Fix Focus Areas
- apps/web/src/app/api/songs/tosing/guest/route.ts[23-30]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| const searchParams = request.nextUrl.searchParams; | ||
| const ids = searchParams.getAll('songIds[]'); | ||
|
|
||
| if (!ids || ids.length === 0) { | ||
| return NextResponse.json({ success: true, data: [] }); | ||
| } | ||
|
|
||
| const supabase = await createClient(); | ||
|
|
||
| const { data, error } = await supabase | ||
| .from('songs') | ||
| .select('*', { count: 'exact' }) | ||
| .in('id', ids); |
There was a problem hiding this comment.
3. songids[] not validated 📘 Rule violation ⛨ Security
• 외부 입력인 쿼리 파라미터 songIds[]를 형식/길이/개수 제한 없이 그대로 DB 조회에 사용하고 있습니다. • 비정상적으로 많은 ID 요청(DoS성)이나 잘못된 형식 입력으로 인한 예외/성능 저하를 유발할 수 있습니다. • ID 형식(예: UUID) 검증과 최대 개수 제한, 빈 값/중복 처리 등을 추가해야 합니다.
Agent Prompt
## Issue description
`songIds[]`가 검증 없이 DB 조회에 사용되어 악성/비정상 입력에 취약합니다.
## Issue Context
security-first input validation 요구사항에 따라 외부 입력은 검증/정제되어야 합니다.
## Fix Focus Areas
- apps/web/src/app/api/songs/tosing/guest/route.ts[9-21]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| queryClient.setQueryData(['toSingSong'], (old: ToSingSong[]) => { | ||
| old.filter(song => song.songs.id !== songId); | ||
| }); |
There was a problem hiding this comment.
4. setquerydata returns undefined 📘 Rule violation ⛯ Reliability
• useDeleteToSingSongMutation().onMutate에서 setQueryData 콜백이 old.filter(...) 결과를 return하지 않아 캐시가 undefined로 설정될 수 있습니다. • 이후 렌더/로직에서 배열을 기대하면 런타임 오류로 이어져, 실패 지점에 대한 방어가 부족합니다. • 필터 결과를 반환하고, old가 undefined/빈 배열인 케이스도 안전하게 처리해야 합니다.
Agent Prompt
## Issue description
`setQueryData` 콜백이 값을 반환하지 않아 캐시가 `undefined`가 될 수 있습니다.
## Issue Context
robust error handling 요구사항에 따라 예외/엣지 케이스(예: undefined 데이터)를 방어하고, 상태 업데이트는 항상 일관된 타입을 유지해야 합니다.
## Fix Focus Areas
- apps/web/src/queries/tosingSongQuery.ts[57-63]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| queryClient.invalidateQueries({ queryKey: ['recentSingLog'] }); | ||
| queryClient.invalidateQueries({ queryKey: ['searchSong'] }); | ||
| }, | ||
| onError: error => { |
There was a problem hiding this comment.
2. alert(error.message) used 📘 Rule violation ⛨ Security
• 여러 React Query mutation 에러 처리에서 alert(error.message)로 내부 오류 메시지를 사용자에게 직접 노출하고 있습니다. • 네트워크/서버/DB 관련 상세 메시지가 그대로 표시될 수 있어 보안상 위험하며, 사용자 경험도 저해됩니다. • 사용자-facing 메시지는 일반화하고, 디버깅용 상세는 내부 로그로 분리해야 합니다.
Agent Prompt
## Issue description
mutation 실패 시 `alert(error.message)`로 내부 오류 상세가 사용자에게 노출됩니다.
## Issue Context
secure error handling 요구사항에 따라 사용자-facing 오류는 일반화하고, 상세는 내부 로그로만 남겨야 합니다.
## Fix Focus Areas
- apps/web/src/queries/tosingSongQuery.ts[44-47]
- apps/web/src/queries/songThumbQuery.ts[28-31]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
📌 PR 제목
[Type] : 작업 내용 요약
📌 변경 사항
💬 추가 참고 사항