SEC-014 P2: 安全相關錯誤記錄暴露實作細節

Resolved 💬 2 comments Opened Mar 22, 2026 by stephen-taipei Closed Mar 25, 2026

問題描述

SSLPinningDelegate 記錄詳細的安全錯誤信息(如公鑰雜湊值),若被記錄到遠程分析服務,可能幫助攻擊者進行憑證欺騙。

檔案位置

  • ios-swift/Connectors/Services/SSLPinningDelegate.swift:119
  • ios-swift/Connectors/Services/SSLPinningDelegate.swift:133

詳細說明

logError(\"Public key pinning FAILED for \\(host). Server hash: \\(serverPublicKeyHash), Expected: \\(pinnedPublicKeyHashes)\", category: .network)
logError(\"Failed to export public key: \\(error?.takeRetainedValue().localizedDescription ?? \\\"Unknown error\\\")\", category: .network)

風險評估

  • 實作細節洩漏幫助攻擊者
  • 公鑰雜湊值暴露
  • Crash Reporter 可能傳輸詳細日誌

解決方案

  1. Release build 中不記錄詳細的安全相關錯誤
  2. 使用通用錯誤訊息(如 \"Certificate validation failed\")面向使用者
  3. 僅在 DEBUG build 記錄完整實作細節
  4. 所有安全相關日誌不應發送至遠程分析服務

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗