[P1][security] public API error 응답에서 내부 상세 정보 노출 줄이기 #33

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

문제

여러 API 경로에서 api_error_reply(..., &err.to_string()) 패턴이 사용됩니다. 내부 파일 경로, provider error, parser detail, filesystem detail 등이 client에게 그대로 노출될 수 있습니다.

관련 후보:

  • crates/portal-relay/src/api/mod.rs
  • crates/portal-relay/src/api/envelope.rs
  • 각 API handler

위험

  • 내부 구현/경로/환경 정보 노출
  • 공격자가 parse/provider/filesystem error를 oracle처럼 활용 가능
  • client-facing error contract가 불안정해짐

제안

  • public API error는 안정적인 code/message로 제한
  • 상세 error는 tracing log에만 남김
  • ApiErrorCode enum 및 error mapping layer 도입
  • admin-only endpoint와 public endpoint의 상세도 구분

완료 기준

  • public API 응답에 raw anyhow/internal error string이 직접 노출되지 않음
  • log에는 correlation id/request id와 상세 error 기록
  • 주요 error mapping 테스트 추가

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

## 문제 여러 API 경로에서 `api_error_reply(..., &err.to_string())` 패턴이 사용됩니다. 내부 파일 경로, provider error, parser detail, filesystem detail 등이 client에게 그대로 노출될 수 있습니다. 관련 후보: - `crates/portal-relay/src/api/mod.rs` - `crates/portal-relay/src/api/envelope.rs` - 각 API handler ## 위험 - 내부 구현/경로/환경 정보 노출 - 공격자가 parse/provider/filesystem error를 oracle처럼 활용 가능 - client-facing error contract가 불안정해짐 ## 제안 - public API error는 안정적인 code/message로 제한 - 상세 error는 `tracing` log에만 남김 - `ApiErrorCode` enum 및 error mapping layer 도입 - admin-only endpoint와 public endpoint의 상세도 구분 ## 완료 기준 - public API 응답에 raw `anyhow`/internal error string이 직접 노출되지 않음 - log에는 correlation id/request id와 상세 error 기록 - 주요 error mapping 테스트 추가 --- 검토 기준: 업로드된 Rust `portal-relay` 코드 정적 리뷰. 리뷰 환경에서는 `cargo check/test/clippy`를 실행하지 못했습니다.
Owner

수용했습니다. PR #62에서 public invalid JSON/internal error/keyless error 등 주요 raw internal error 노출 경로를 안정 메시지로 줄이고 상세는 log에 남기도록 변경했습니다. Lease/domain validation처럼 client가 고쳐야 하는 입력 오류는 기존 API contract를 유지했습니다. 검증: cargo test --locked, cargo clippy --locked --all-targets -- -D warnings.

수용했습니다. PR #62에서 public invalid JSON/internal error/keyless error 등 주요 raw internal error 노출 경로를 안정 메시지로 줄이고 상세는 log에 남기도록 변경했습니다. Lease/domain validation처럼 client가 고쳐야 하는 입력 오류는 기존 API contract를 유지했습니다. 검증: cargo test --locked, cargo clippy --locked --all-targets -- -D warnings.
gofix closed this issue 2026-05-03 18:58:40 +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#33
No description provided.