[P2][auth] SIWE registration 검증을 full EIP-4361 parser/validator 기반으로 보강 #42

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

문제

현재 SIWE registration flow는 서버가 생성한 고정 문자열을 challenge에 저장한 뒤, /sdk/register에서 제출된 siwe_message와 exact match를 하고 Ethereum personal_sign 서명을 검증하는 구조입니다.

이 방식은 서버 생성 challenge에 대해서는 동작하지만, EIP-4361 SIWE message를 구조적으로 parse/validate하는 범용 SIWE 검증은 아닙니다.

현재 동작

  • auth/siwe.rs::build_register_message()가 고정 SIWE-like 문자열 생성
  • leases.rs::consume_verified_challenge()가 저장된 문자열과 제출 문자열 exact match
  • auth/siwe.rs::verify_personal_signature()가 EIP-191 personal message hash + secp256k1 recovery로 address 검증

한계

  • domain, uri, version, chain id, nonce, issued at, expiration time, request id를 독립적으로 parse/validate하지 않음
  • SIWE 필드 validation이 challenge exact match에 암묵적으로 의존
  • 향후 SIWE message 형식 변경, multi-domain, client interop 확장 시 검증 책임이 불명확해질 수 있음

제안

  • EIP-4361 SIWE parser/validator 도입 또는 최소한 내부 parser 추가
  • exact match는 유지하되, 구조적 필드 검증을 추가
  • domain/URI/nonce/request_id/expiration/chain_id를 명시적으로 검증
  • Go upstream 호환성이 필요하다면 compatibility test로 message shape 유지

완료 기준

  • 제출된 SIWE message를 구조적으로 parse하고 필수 필드를 검증
  • 기존 Go 호환 registration flow는 유지
  • malformed SIWE field regression test 추가

검토 기준: portal-relay SIWE registration flow 정적 리뷰. 관련 코드: crates/portal-relay/src/auth/siwe.rs, crates/portal-relay/src/relay/leases.rs, crates/portal-relay/src/api/mod.rs.

## 문제 현재 SIWE registration flow는 서버가 생성한 고정 문자열을 challenge에 저장한 뒤, `/sdk/register`에서 제출된 `siwe_message`와 exact match를 하고 Ethereum `personal_sign` 서명을 검증하는 구조입니다. 이 방식은 서버 생성 challenge에 대해서는 동작하지만, EIP-4361 SIWE message를 구조적으로 parse/validate하는 범용 SIWE 검증은 아닙니다. ## 현재 동작 - `auth/siwe.rs::build_register_message()`가 고정 SIWE-like 문자열 생성 - `leases.rs::consume_verified_challenge()`가 저장된 문자열과 제출 문자열 exact match - `auth/siwe.rs::verify_personal_signature()`가 EIP-191 personal message hash + secp256k1 recovery로 address 검증 ## 한계 - domain, uri, version, chain id, nonce, issued at, expiration time, request id를 독립적으로 parse/validate하지 않음 - SIWE 필드 validation이 challenge exact match에 암묵적으로 의존 - 향후 SIWE message 형식 변경, multi-domain, client interop 확장 시 검증 책임이 불명확해질 수 있음 ## 제안 - EIP-4361 SIWE parser/validator 도입 또는 최소한 내부 parser 추가 - exact match는 유지하되, 구조적 필드 검증을 추가 - domain/URI/nonce/request_id/expiration/chain_id를 명시적으로 검증 - Go upstream 호환성이 필요하다면 compatibility test로 message shape 유지 ## 완료 기준 - 제출된 SIWE message를 구조적으로 parse하고 필수 필드를 검증 - 기존 Go 호환 registration flow는 유지 - malformed SIWE field regression test 추가 --- 검토 기준: `portal-relay` SIWE registration flow 정적 리뷰. 관련 코드: `crates/portal-relay/src/auth/siwe.rs`, `crates/portal-relay/src/relay/leases.rs`, `crates/portal-relay/src/api/mod.rs`.
Owner

검토했지만 이번 범위에서는 수용하지 않습니다. 현재 registration은 서버가 생성/저장한 SIWE-like challenge의 exact match와 personal_sign address recovery를 함께 요구하므로, 외부 임의 SIWE message parser가 없어도 현재 프로토콜 보안 결함으로 보기는 어렵습니다. full EIP-4361 parser 도입은 상호운용 확장 과제이며 메시지 shape 변경 회귀 위험이 있어 닫습니다.

검토했지만 이번 범위에서는 수용하지 않습니다. 현재 registration은 서버가 생성/저장한 SIWE-like challenge의 exact match와 personal_sign address recovery를 함께 요구하므로, 외부 임의 SIWE message parser가 없어도 현재 프로토콜 보안 결함으로 보기는 어렵습니다. full EIP-4361 parser 도입은 상호운용 확장 과제이며 메시지 shape 변경 회귀 위험이 있어 닫습니다.
gofix closed this issue 2026-05-03 18:58:43 +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#42
No description provided.