healthcheck 블록에 TLS 프론트 내부 검증 옵션 추가 - #40
Conversation
- core 의 전환 후 프론트 검증(https://127.0.0.1/health, cert 는 도메인 앞)이 이 블록으로 안 돼 raw curl 배선이 호출부에 생길 참이었다. 폴링·재시도·종료코드 배선을 블록 한 곳에 유지하려 TLS 검증 생략(-k)과 Host 헤더 지정을 옵션으로 더한다 - 테스트 3케이스 추가: 자가서명 TLS 서버(인라인 핸들러)를 띄워 insecure 없이는 실패, host-header 는 서버가 Host 일치 때만 200 을 주게 해 헤더가 실제 전송됨을 증명
📝 WalkthroughWalkthrough
Changes헬스체크 HTTPS 옵션 및 검증
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant Healthcheck as healthcheck.sh
participant Curl as curl
participant Server as HTTPS test server
Caller->>Healthcheck: --insecure 및 --host-header 전달
Healthcheck->>Curl: 요청 옵션과 URL 전달
Curl->>Server: HTTPS 요청
Server-->>Curl: HTTP 상태와 응답 본문
Curl-->>Healthcheck: 요청 결과
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@blocks/healthcheck.sh`:
- Line 50: 인자를 받는 옵션 처리 로직에서 값 누락을 명시적으로 검증하십시오. `--host-header`를 포함한 `--url`,
`--interval`, `--attempts`, `--timeout`, `--expect-body` 각 분기에서 먼저 인자가 두 개 이상인지
확인하고, 부족하면 `exit 2`로 종료한 뒤에만 값을 설정하고 `shift 2`를 수행하도록 수정하십시오.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b7ce7e6d-9be1-4d63-8044-7e6989b493d6
📒 Files selected for processing (2)
blocks/healthcheck.shblocks/healthcheck.test.sh
| --timeout) TIMEOUT="${2:-}"; shift 2;; | ||
| --expect-body) EXPECT_BODY="${2:-}"; shift 2;; | ||
| --insecure) INSECURE=1; shift 1;; | ||
| --host-header) HOST_HEADER="${2:-}"; shift 2;; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
# `--host-header`만 전달한 경우의 Bash shift 동작을 확인한다.
set +e
bash -c '
set -euo pipefail
set -- --host-header
case "$1" in
--host-header) HOST_HEADER="${2:-}"; shift 2;;
esac
'
status=$?
set -e
printf 'parser exit status: %s\n' "$status"
test "$status" -ne 2Repository: TeamPiKi/infra
Length of output: 174
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- blocks/healthcheck.sh ---'
nl -ba blocks/healthcheck.sh | sed -n '1,130p'
printf '%s\n' '--- required-value option handlers ---'
rg -n -C 2 -- '--host-header|--url|--timeout|shift 2|requires a value|argument' blocks/healthcheck.shRepository: TeamPiKi/infra
Length of output: 222
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- blocks/healthcheck.sh ---'
awk '{printf "%5d %s\n", NR, $0}' blocks/healthcheck.sh | sed -n '1,130p'
printf '%s\n' '--- required-value option handlers ---'
grep -n -C 2 -E -- '--host-header|--url|--timeout|shift 2|requires a value|argument' blocks/healthcheck.sh || trueRepository: TeamPiKi/infra
Length of output: 4980
값을 받는 옵션의 인자 누락을 처리하십시오.
--host-header만 전달하면 shift 2가 실패하고 종료 코드 1을 반환합니다. --url, --interval, --attempts, --timeout, --expect-body도 같은 문제가 있습니다. 각 옵션에서 $# -ge 2를 검사하고, 값이 없으면 exit 2로 종료하십시오.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@blocks/healthcheck.sh` at line 50, 인자를 받는 옵션 처리 로직에서 값 누락을 명시적으로 검증하십시오.
`--host-header`를 포함한 `--url`, `--interval`, `--attempts`, `--timeout`,
`--expect-body` 각 분기에서 먼저 인자가 두 개 이상인지 확인하고, 부족하면 `exit 2`로 종료한 뒤에만 값을 설정하고
`shift 2`를 수행하도록 수정하십시오.
Situation
Action
--insecure(curl -k)·--host-header옵션 추가. 값은 종전대로 호출부 소유, 미지정 시 기존 동작과 동일(additive).Result
연관 이슈
Summary by CodeRabbit
--insecure옵션을 추가했습니다.Host헤더를 지정할 수 있는--host-header <값>옵션을 지원합니다.