[P0][DoS] challenge/lease/UDP flow/session map에 cap 및 rate limit 추가 #24

Closed
opened 2026-05-02 04:34:04 +00:00 by boxqkrtm · 1 comment

문제

여러 runtime map/queue가 메모리에 쌓일 수 있지만 생성 rate limit, per-IP cap, global cap이 부족합니다.

대표 대상:

  • LeaseRegistryInner.challenges
  • LeaseRegistryInner.leases
  • LeaseRegistryInner.hop_routes
  • UdpDatagramState.flow_table
  • admin session map
  • RelayStream.ready queue 및 reverse session 관련 상태

특히 registration challenge는 누구나 만들 수 있고 TTL janitor가 있더라도 생성 속도를 막지 못합니다.

위험

  • challenge flooding으로 메모리 증가
  • UDP flow table flooding
  • active lease/hop route 누적
  • admin session/session queue 고갈
  • public relay에서 connection/task/memory 기반 DoS 가능

제안

  • per-IP challenge 생성 제한 및 global challenge cap
  • active lease/hop route global cap 및 per-identity/per-IP cap
  • UDP flow table max size와 LRU/TTL eviction
  • admin session cap 및 오래된 session eviction
  • token bucket/governor 기반 rate limit 도입
  • janitor cleanup metrics/export 추가

완료 기준

  • cap 초과 시 안정적인 429/503/거부 처리
  • cap 초과 상황에서도 메모리 사용량이 bounded
  • challenge flood, UDP flow flood, session cap 테스트 추가

검토 기준: 업로드된 Rust portal-relay 코드 정적 리뷰. 리뷰 환경에서는 cargo check/test/clippy를 실행하지 못했습니다.

## 문제 여러 runtime map/queue가 메모리에 쌓일 수 있지만 생성 rate limit, per-IP cap, global cap이 부족합니다. 대표 대상: - `LeaseRegistryInner.challenges` - `LeaseRegistryInner.leases` - `LeaseRegistryInner.hop_routes` - `UdpDatagramState.flow_table` - admin session map - `RelayStream.ready` queue 및 reverse session 관련 상태 특히 registration challenge는 누구나 만들 수 있고 TTL janitor가 있더라도 생성 속도를 막지 못합니다. ## 위험 - challenge flooding으로 메모리 증가 - UDP flow table flooding - active lease/hop route 누적 - admin session/session queue 고갈 - public relay에서 connection/task/memory 기반 DoS 가능 ## 제안 - per-IP challenge 생성 제한 및 global challenge cap - active lease/hop route global cap 및 per-identity/per-IP cap - UDP flow table max size와 LRU/TTL eviction - admin session cap 및 오래된 session eviction - token bucket/governor 기반 rate limit 도입 - janitor cleanup metrics/export 추가 ## 완료 기준 - cap 초과 시 안정적인 429/503/거부 처리 - cap 초과 상황에서도 메모리 사용량이 bounded - challenge flood, UDP flow flood, session cap 테스트 추가 --- 검토 기준: 업로드된 Rust `portal-relay` 코드 정적 리뷰. 리뷰 환경에서는 `cargo check/test/clippy`를 실행하지 못했습니다.
Owner

수용했습니다. PR #62에서 challenge global/per-IP cap, active lease cap, hop route cap, UDP flow table cap, admin session cap을 추가했습니다. 기존 ready queue cap과 함께 메모리 증가 경로를 bounded하게 만들었습니다. 검증: cargo test --locked, cargo clippy --locked --all-targets -- -D warnings.

수용했습니다. PR #62에서 challenge global/per-IP cap, active lease cap, hop route cap, UDP flow table cap, admin session cap을 추가했습니다. 기존 ready queue cap과 함께 메모리 증가 경로를 bounded하게 만들었습니다. 검증: cargo test --locked, cargo clippy --locked --all-targets -- -D warnings.
gofix closed this issue 2026-05-03 18:58:36 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gofix/portal-tunnel-rs#24
No description provided.