Repository navigation
[oneseo] 모의 성적 계산·FAQ API 키를 서버 전용 환경변수로 이동 - #580
Merged
Merged
Conversation
…rd-notice-popup [notice] 생기부 간인 안내 팝업 제거 및 결핵검사 안내 팝업 추가
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
Member
|
/review |
There was a problem hiding this comment.
Overview
모의 성적 계산 API와 FAQ(Notion) API 키를 NEXT_PUBLIC_*가 아닌 서버 전용 환경변수로 옮기고, 클라이언트에서 직접 업스트림 API를 호출하던 부분을 같은 origin의 /api/mock-score Route Handler를 거치는 프록시 구조로 바꾼 PR입니다.
Intent
API 인증 키가 클라이언트 번들에 포함되지 않도록 방지하고, 요청 흐름을 서버측 프록시로 옮겨 시크릿 노출 위험을 줄이기 위한 보안/배포 구성 변경입니다.
Risk
머지 전 Vercel 서버 환경변수가 반드시 추가되어야 하며, 누락 시 모의 성적 계산과 FAQ가 정상 동작하지 않습니다. 서버 프록시의 요청 검증, 본문 크기 제한, 타임아웃, 상태 코드 전달 방식과 업스트림이 Origin·Referer·IP 같은 헤더/네트워크 조건을 요구할 경우의 호환성을 검토할 필요가 있습니다.
4 inline comment(s)
vercel
Bot
temporarily deployed
to
Preview – hellogsm-client-26-admin
November 12, 2026 00:03
Inactive
s2yeons
approved these changes
Nov 12, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요 💡
모의 성적 계산 API와 FAQ(Notion) API의 인증 키를 서버 전용 환경변수로 옮기고, 브라우저는 같은 origin의 Route Handler로만 요청하도록 변경하였습니다.
작업내용 ⌨️
packages/api/src/server/handlePostMockScore.ts공통 handler를 추가하고@repo/api/server로만 노출하였습니다(hooks·apis·lib 진입점에서는 re-export하지 않습니다).MOCK_SCORE_URL,MOCK_SCORE_API_KEY로 업스트림에 요청을 전달하고, 업스트림의 상태 코드와 JSON 본문을 그대로 반환합니다.{code, message, status}형식으로 반환합니다.app/api/mock-score/route.ts를 추가하였습니다. admin의 원서 수정 화면 4단계 "내 성적 계산하기"도 같은 hook을 사용하므로 두 앱 모두 필요합니다.usePostMockScore는/api/mock-score로 요청하도록 변경하였습니다. 반환 타입·옵션·mutationKey는 그대로입니다.NOTION_SECRET_API_KEY로 변경하였습니다.turbo.json의client#build·admin#buildenv와 두 앱의.env.example에 새 변수를 추가하였습니다.packages/api에test스크립트와tsxdevDependency를 추가하였습니다.검증
pnpm install --frozen-lockfile,pnpm check-types,pnpm lint(오류 0),pnpm --filter @repo/api test(11개 통과)next build후 client(3000)·admin(3001)을 가짜 업스트림에 연결해/api/mock-score의 200 전달, 업스트림 422 상태 전달, 업스트림 응답 헤더 미전달, 잘못된 본문 400을 확인하였습니다..next/static에 모의 성적 계산 키 값이 포함되지 않는 것을 확인하였습니다.리뷰 요청사항 👀
MOCK_SCORE_URL,MOCK_SCORE_API_KEY,NOTION_SECRET_API_KEY(기존NEXT_PUBLIC_변수의 값을 그대로 사용)MOCK_SCORE_URL,MOCK_SCORE_API_KEYNEXT_PUBLIC_MOCK_SCORE_URL,NEXT_PUBLIC_MOCK_SCORE_API_KEY,NEXT_PUBLIC_NOTION_SECRET_API_KEY는 배포가 안정된 뒤 삭제하면 됩니다(롤백 대비).