[P2][refactor] PolicyRuntime을 settings store, policy engine, BPS limiter, IP resolver로 분리 #37

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

문제

crates/portal-relay/src/policy/mod.rsPolicyRuntime이 persisted admin settings, approval/deny/ban, IP ban, identity-IP mapping, BPS limiter, proxy header trust/client IP extraction까지 동시에 처리합니다.

영향

  • persisted state와 runtime-only limiter state가 같은 mutex/타입에 결합
  • policy save/read와 rate limiting이 불필요하게 얽힘
  • request path 성능 및 테스트 격리가 어려움

제안 구조

policy/
  admin_settings_store.rs
  policy_engine.rs
  bps_limiter.rs
  client_ip_resolver.rs

완료 기준

  • persisted settings 저장/로드와 runtime limiter state가 분리
  • client IP resolution은 독립 테스트 가능
  • approval/deny/ban decision은 policy engine에서 일관되게 수행

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

## 문제 `crates/portal-relay/src/policy/mod.rs`의 `PolicyRuntime`이 persisted admin settings, approval/deny/ban, IP ban, identity-IP mapping, BPS limiter, proxy header trust/client IP extraction까지 동시에 처리합니다. ## 영향 - persisted state와 runtime-only limiter state가 같은 mutex/타입에 결합 - policy save/read와 rate limiting이 불필요하게 얽힘 - request path 성능 및 테스트 격리가 어려움 ## 제안 구조 ```text policy/ admin_settings_store.rs policy_engine.rs bps_limiter.rs client_ip_resolver.rs ``` ## 완료 기준 - persisted settings 저장/로드와 runtime limiter state가 분리 - client IP resolution은 독립 테스트 가능 - approval/deny/ban decision은 policy engine에서 일관되게 수행 --- 검토 기준: 업로드된 Rust `portal-relay` 코드 정적 리뷰. 리뷰 환경에서는 `cargo check/test/clippy`를 실행하지 못했습니다.
Owner

검토했지만 이번 범위에서는 수용하지 않습니다. PolicyRuntime 분리는 내부 설계 개선 제안이며 현재 사용자 영향 버그로 확인되지 않았습니다. admin/session/IP/BPS 관련 실질 hardening은 PR #62에서 보강했으므로 이 구조 리팩터링 이슈는 닫습니다.

검토했지만 이번 범위에서는 수용하지 않습니다. PolicyRuntime 분리는 내부 설계 개선 제안이며 현재 사용자 영향 버그로 확인되지 않았습니다. admin/session/IP/BPS 관련 실질 hardening은 PR #62에서 보강했으므로 이 구조 리팩터링 이슈는 닫습니다.
gofix closed this issue 2026-05-03 18:58:41 +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#37
No description provided.