Android: pinned OkHttpClient lazy fallback can permanently bind to non-pinned client

Đang mở
#7,248 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
android, kotlin
Lĩnh vực
mobile, security

Hướng nghiên cứu

Bắt đầu với MediaCallsAnswerRequest.kt:45-53 và DDPClient.kt:29, sau đó truy vết cách các client lazy tương ứng trong companion của chúng được MediaCallsAnswerRequest.fetch và các kết nối DDPClient sử dụng. Tái hiện đường đi cold-start khi chưa chọn chứng chỉ nào, sau đó chọn một chứng chỉ và xác minh rằng các lần gọi tiếp theo không còn tái sử dụng client thông thường hoặc âm thầm bỏ qua SSL pinning.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

needs-security-review type: bug

Problem

MediaCallsAnswerRequest.kt:45-53 and DDPClient.kt:29 both initialize the OkHttp client via a companion by lazy block:

```kotlin
private val httpClient: OkHttpClient by lazy {
SSLPinningTurboModule.getSharedOkHttpClient() ?: OkHttpClient()
}
```

If a VoIP notification (or DDP message) arrives during cold start before the user has selected a certificate, the lazy initializer triggers when the shared pinned client is still null, permanently binding to a plain OkHttpClient() for the process lifetime. Subsequent calls — including manual certificate selection later in the session — reuse the cached non-pinned fallback and silently bypass SSL pinning.

Where this surfaces

  • VoIP accept REST (MediaCallsAnswerRequest.fetch) when invoked from a PushKit/FCM cold-start handler
  • DDPClient connections under similar cold-start conditions

Suggested fix

Resolve the shared client at each call site rather than at lazy initialization, OR fail-fast with onResult(false) when getSharedOkHttpClient() returns null.

Background

Spotted by CodeRabbit on https://github.com/RocketChat/Rocket.Chat.ReactNative/pull/7245 — this is a pre-existing bug, not introduced by that PR. Filing separately so it doesn't block the release-readiness queue.

Ngôn ngữ chính
TypeScript
Star
2.4k
Fork
1.5k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
29

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của RocketChat/Rocket.Chat.ReactNative

Tất cả issue của RocketChat/Rocket.Chat.ReactNative

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.