
# 공격 방어 설정 조회

`GET /v1/attack-protection` · 권한 `attack-protection:read`

환경의 공격 방어 객체를 반환합니다. 무차별 대입 공격, 의심스러운 IP 제한, 자격 증명 채우기, 봇 방어, 유출된 비밀번호, 가입 방어, SMS 방어, 위험 정책이 포함됩니다. 각 섹션에는 두 가지 보기가 있습니다. `configured`는 직접 작성한 값이고, `effective`는 기본값, 보안 하한선, 요금제가 적용된 실제 적용 값입니다. 한 번도 작성하지 않은 섹션은 `configured: {}`입니다. `ETag` 응답 헤더는 객체의 내용을 식별하며, `PUT`과 `PATCH`에서 `If-Match`로 보내야 합니다.

## 요청

이 작업에는 경로, 쿼리, 본문 필드가 없습니다. 환경은 자격 증명에서 정해집니다.

## 응답

객체와 `ETag` 헤더가 포함된 `200 OK`입니다.

```json
{
  "schema_version": 1,
  "brute_force": {
    "configured": {"max_failures": 10},
    "effective": {"mode": "enforce", "max_failures": 10, "window_minutes": 15, "lock_minutes": 15, "notify_user": true}
  },
  "risk_policy": {
    "configured": {"mode": "enforce"},
    "effective": {"mode": "log", "challenge_threshold": 4, "block_threshold": null, "notify_user_on_new_device": true}
  },
  "bot_protection": {
    "configured": {},
    "effective": {"mode": "risk_based", "provider": "altcha"}
  }
}
```

예시는 간략화되어 있습니다. 모든 응답에는 여덟 개 섹션(`brute_force`, `suspicious_ip_throttling`, `credential_stuffing`, `bot_protection`, `breached_password`, `signup_protection`, `sms_protection`, `risk_policy`)이 모두 포함됩니다. 예시에서는 요금제에 위험 적용이 더 이상 포함되지 않으므로 설정된 `enforce` 값은 유지되지만 `log`로 표시됩니다.

## 필드

| 필드 | 타입 | 범위 또는 값 | 기본값 | 하한 |
|---|---|---|---|---|
| `brute_force.mode` | 텍스트 | `log`, `enforce` | `enforce` | |
| `brute_force.max_failures` | 정수 | 5-100 | 20 | 최대 100 |
| `brute_force.window_minutes` | 정수 | 5-60 | 15 | |
| `brute_force.lock_minutes` | 정수 | 5-60 | 15 | 최소 5 |
| `brute_force.notify_user` | 불리언 | | `true` | |
| `suspicious_ip_throttling.mode` | 텍스트 | `log`, `enforce` | `enforce` | |
| `suspicious_ip_throttling.login_failures_per_ip_per_day` | 정수 | 10-10000 | 100 | |
| `suspicious_ip_throttling.signups_per_ip_per_hour` | 정수 | 1-20 | 20 | 최대 20 |
| `suspicious_ip_throttling.allowlist` | 텍스트 배열 | CIDR 접두사 최대 100개; IPv4는 /8보다, IPv6는 /32보다 넓을 수 없음 | `[]` | |
| `credential_stuffing.mode` | 텍스트 | `log`, `enforce` | `enforce` | |
| `credential_stuffing.attack_mode_auto` | 불리언 | | `true` | |
| `credential_stuffing.attack_mode_duration_minutes` | 정수 | 15-240 | 30 | |
| `bot_protection.mode` | 텍스트 | `off`, `risk_based`, `always` | `risk_based` | |
| `bot_protection.provider` | 텍스트 | `altcha` | `altcha` | |
| `breached_password.on_signup` | 텍스트 | `block` | `block` | `block` |
| `breached_password.on_password_change` | 텍스트 | `block` | `block` | `block` |
| `breached_password.on_login` | 텍스트 | `require_reset`, `notify` | `require_reset` | |
| `breached_password.notify_user` | 불리언 | | `true` | |
| `signup_protection.block_disposable_email` | 불리언 | | `true` | |
| `signup_protection.block_email_subaddress` | 불리언 | | `false` | |
| `signup_protection.max_signups_per_device_30d` | 정수 | 1-50 | 3 | |
| `sms_protection.allowed_countries` | 텍스트 배열 | ISO 3166-1 alpha-2 코드 최대 250개 | `[]` (요금제 기본값) | |
| `sms_protection.daily_cap` | 정수 \| null | 1-1000000; `null`은 요금제 값 | `null` | |
| `sms_protection.conversion_breaker` | 불리언 | | `true` | `true` |
| `risk_policy.mode` | 텍스트 | `log`, `enforce` (`enforce`는 Startup 이상 요금제 필요) | `log` | |
| `risk_policy.challenge_threshold` | 정수 | 3-8 | 4 | |
| `risk_policy.block_threshold` | 정수 \| null | 6-12, `challenge_threshold`보다 커야 함; `null`은 끔 | `null` | |
| `risk_policy.notify_user_on_new_device` | 불리언 | | `true` | |

## 오류

| HTTP | 코드 | 발생 시점 |
|---|---|---|
| 401 | `unauthenticated` | 자격 증명이 없거나, 잘못되었거나, 폐기되었습니다. |
| 403 | `insufficient_permissions` | 자격 증명에 필요한 권한이 없습니다. |
| 429 | `rate_limited` | 요청 한도를 초과했습니다. `Retry-After` 시간 후에 다시 시도하십시오. |
| 503 | `service_unavailable` | 종속 서비스를 일시적으로 사용할 수 없습니다. `Retry-After` 시간 후에 다시 시도하십시오. |

## 예시

```bash
curl https://api.eu.keenauth.com/v1/attack-protection \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY"
```
