Files

2.9 KiB

title, category, error_codes, severity, owner, last_updated, status
title category error_codes severity owner last_updated status
Runbook — JWT key rotation 시 인증 실패 spike AUTH
AUTH_TOKEN_EXPIRED
AUTH_KID_UNKNOWN
AUTH_JWKS_UNAVAILABLE
AUTH_TOKEN_INVALID_SIGNATURE
P1 oncall 2026-05-22 stub

Runbook: JWT key rotation 시 인증 실패 spike

1. Trigger

이 runbook은 다음 alert에서 발동됩니다.

  • alert name: auth_401_error_rate_high 또는 jwks_refresh_failure_spike
  • alert payload 필수 field: operation, error.code, error.category, runbook_link, dependency_name
  • 임계: 401 error rate > 5% 5분 지속 OR JWKS refresh failure count > 10건/분

2. First Response (5분 이내)

Step 1 — 확인

  1. JWKS endpoint health check: curl -sf https://<idp-host>/.well-known/jwks.json | jq '.keys | length'
  2. log query에서 error.code 분포 확인 — AUTH_KID_UNKNOWN 비중이 높으면 rotation 원인 강력 시사
  3. IdP rotation schedule 확인 (직전 24h 내 rotation 이벤트가 있었는지)

Step 2 — 임시 격리

  • JWKS cache TTL을 짧게(예: 60s) 강제하여 새 kid 전파 가속
  • 새 kid가 JWKS에 publish되어 있는지 확인. 누락이면 IdP에 republish 요청

3. Diagnosis

  • log query (Loki/CloudWatch): {service="auth"} | error.category="AUTH" | dependency_name="jwks-endpoint"
  • metric panel: auth_jwks_cache_hit_ratio, auth_jwks_refresh_failure_total, auth_kid_unknown_total
  • trace: 실패한 request 1건에서 traceId 추출 → IdP outbound span 확인
  • 가능한 원인:
    • 새 kid가 JWKS에 publish되기 전 token 발급 → 24h overlap window 안에 있는지 확인
    • JWKS endpoint 장애 (5xx, timeout) → IdP status page 확인
    • 시계 skew로 인한 만료 오판 → NTP sync 상태 확인

4. Mitigation

  • 단기: old kid를 임시 재허용 (rollback). overlap window를 48h로 일시 확장
  • IdP에 새 JWKS publish 재시도 요청
  • 장기: rotation 절차에 "publish → 24h 대기 → switch" 단계 강제. observability에 kid 분포 metric 추가

5. Escalation

  • P2 → P1 격상 조건: 401 error rate > 20% 또는 다중 tenant에 동시 발생
  • 다음 on-call로 page: 10분 내 회복 안 되면 IdP team 또는 platform-security team page

6. Recovery / Verification

  • 회복 확인 metric: auth_401_error_rate < 1% 5분 지속, AUTH_KID_UNKNOWN 건수 0
  • post-incident:
    • rotation 절차 RCA 작성
    • JWKS overlap window 정책 문서 업데이트
    • kid 분포 dashboard 영구화
  • error-codes.yaml rows: AUTH_TOKEN_EXPIRED, AUTH_KID_UNKNOWN, AUTH_JWKS_UNAVAILABLE, AUTH_TOKEN_INVALID_SIGNATURE
  • metrics.yaml: auth_jwks_cache_hit_ratio, auth_jwks_refresh_failure_total
  • 관련 branch: feature-security-operational-baseline

Stub 상태 안내: 이 runbook은 skeleton 단계의 stub. 도메인 도입 시 실제 IdP 종류·rotation 정책·JWKS endpoint URL·dashboard 링크로 보강 필요.