Repository navigation
건강 점검 + 안전한 개선 2건: Windows verify:package 수정 · HTTP 경계 환경변수 문서화 - #173
Conversation
…단 수정
- spawnSync("npm", [args])는 Windows에서 npm이 .cmd 심링크라 ENOENT/EINVAL로
실패한다. shell: true + 단일 명령어 문자열로 실행(DEP0190 회피).
인자는 정적 리터럴이라 인젝션 면이 없다.
- 결과: Windows에서 npm run verify:package · prepack · 로컬 npm publish 경로 복구.
docs: HTTP 실행 경계 환경변수 4종 문서화
- README(한국어) 'HTTP·실행 경계 설정'에 ALLOWED_ORIGINS·CORS_ORIGIN·
ALLOW_QUERY_API_KEY·ACCESS_LOG 추가 — 서버는 구현돼 있었으나 한국어 문서에
누락돼 있었고, ALLOWED_ORIGINS는 DNS rebinding 방어와 직결된 보안 설정.
- README-EN.md 환경변수 표에 ACCESS_LOG 행 추가(나머지 3종은 이미 있음).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a753e3e050
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ## HTTP·실행 경계 설정 | ||
|
|
||
| - HTTP 기본 바인딩은 `MCP_HTTP_HOST=127.0.0.1`, 프록시 신뢰 기본값은 `TRUST_PROXY=false`입니다. 외부 바인딩은 `MCP_AUTH_TOKEN`을 설정해야 하며, 의도적으로 공개할 때만 `MCP_ALLOW_UNAUTHENTICATED_REMOTE=1`을 명시합니다. 프록시 뒤에서는 `TRUST_PROXY=1`처럼 정확한 hop 수를 설정하세요. | ||
| - **브라우저(웹) 클라이언트를 쓸 때는 `ALLOWED_ORIGINS`를 설정하세요.** MCP 명세가 요구하는 Origin 검증(DNS rebinding 방어) 때문에, `Origin` 헤더가 붙은 요청은 `ALLOWED_ORIGINS` 화이트리스트(콤마 구분)에 있는 출처만 통과합니다. 설정하지 않으면 브라우저 요청은 모두 차단되고 시작 시 안내가 출력됩니다. `CORS_ORIGIN`을 따로 설정한 경우 그 값도 허용 목록에 추가됩니다. |
There was a problem hiding this comment.
Document CORS_ORIGIN as a fallback, not an added origin
When both variables are set and CORS_ORIGIN is not already in ALLOWED_ORIGINS, this sentence tells deployments that both origins will pass validation. resolveOrigin in src/server/http-server.ts:113-120 only consults CORS_ORIGIN when allowedOrigins.length === 0, so requests from that origin instead receive a 403 once the allowlist is nonempty; either union the configured origin in code or document that it is only a fallback.
Useful? React with 👍 / 👎.
|
꼼꼼한 점검 감사합니다. 최신 main 기준으로 확인했고 병합합니다.
|
#173 에서 넣은 문장이 "CORS_ORIGIN 을 설정하면 그 값도 허용 목록에 추가된다"고 했다. http-server.ts 의 resolveOrigin 은 ALLOWED_ORIGINS 가 비어 있을 때만 CORS_ORIGIN 을 기준으로 쓴다(* 면 모든 출처, 아니면 그 출처 하나). ALLOWED_ORIGINS 를 설정하면 CORS_ORIGIN 은 출처 판정에 쓰이지 않는다. 브라우저 요청 전면 차단도 둘 다 비었을 때의 동작이라, 그대로 고쳐 적었다. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q7EF2EFJZMeH4dk7Rm2f15
점검 배경
로컬
main(c6feff0) 기준 건강 점검을 실행하고, 발견된 안전한 개선 2건을 제출합니다.점검 결과 (실행 증거)
npm test→ 165 files / 1354 tests passed, exit 0npm run typecheckexit 0, 오류 0건npm run buildexit 0npm packspawn 실패(exit 1) → 본 PR로 exit 0 복구npm run verify:annex-runtimeexit 0npm run dead-codeexit 0npm audit→ found 0 vulnerabilitieskordoc/pdfjs-dist정확히 핀, 나머지 캐럿 범위 +overrides로 transitive 통제개선 1:
verify-package.mjsWindows 실패 수정 (버그 수정)scripts/verify-package.mjs의packedFiles()가spawnSync("npm", [...])로 npm을 호출합니다. Windows에서는 npm이.cmd심링크라 shell 없이 spawn하면 ENOENT/EINVAL로 실패합니다.npm run verify:package·npm run prepack·CLAUDE.md의 정규 경로인 로컬npm publish를 실행할 수 없었습니다. (리눅스 CI는 정상 동작)spawnSync("npm", …)→status: null, error: spawnSync npm ENOENT;spawnSync("npm.cmd", …)→EINVAL.shell: true시 정상 동작 확인.shell: true+ 단일 명령어 문자열로 실행. 인자는 정적 리터럴(pack --dry-run --json --ignore-scripts)이라 인젝션 면이 없으며, args 배열이 아닌 단일 문자열이므로 DEP0190 경고도 발생하지 않습니다.npm run verify:package→package artifacts verified (314 packed files), exit 0.개선 2: HTTP 실행 경계 환경변수 4종 문서화 (문서)
src/server/http-server.ts가 읽지만 문서에 없던 환경변수를 추가합니다.ALLOWED_ORIGINSCORS_ORIGINALLOW_QUERY_API_KEY=0시?oc=쿼리 키 차단 (폐쇄망 권장)ACCESS_LOG=1시 요청 로그, 경로만 기록(키 유출 방지)ACCESS_LOG행을 추가했습니다.ALLOWED_ORIGINS는 설정 누락 시 브라우저 요청이 전부 차단되는데 한국어 문서에 설명이 없어, 웹 클라이언트 배포 사용자가 원인을 파악하기 어려운 점이 가장 큰 실용적 손실이었습니다.변경 범위
scripts/verify-package.mjs— spawn 호출 1곳 (기능 변경 없음)README.md— 환경변수 설명 3항목 추가 (CRLF 보존)README-EN.md— 환경변수 표 1행 추가기존 동작·도구·API 변경은 없으며, 문서의 도구 수 표기 자동 게이트를 포함한 전체 테스트 1354개 재통과를 확인했습니다.
검증 증거 (본 브랜치)