NIOTransportServices TLS verify block prints "Trust failed" to stdout
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 73/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- swift
- 領域
- backend, networking
調査の方向性
リンク先の Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift にある verify ブロックから始め、TLS オプションの作成時にバックグラウンドアクティビティロガーがどのように利用可能になるかを追ってください。NIOTransportServices を使って、macOS で証明書の検証に失敗した場合の動作を確認してください。失敗理由が stdout に書き込まれなくなり、ロガー経由で引き続き参照できるようになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
On Darwin with NIOTransportServices, when certificate verification fails, the verify block installed by TLSConfiguration.getNWProtocolTLSOptions writes the failure to standard output:
The verify block was added in #350 (for #292) and is installed whenever certificateVerification != .fullVerification || trustRoots != nil. Because TLSConfiguration.makeClientConfiguration() sets trustRoots to .default, this also happens with the default client configuration.
For a command-line tool that prints machine-readable output (for example JSON) on stdout, the extra line corrupts the output.
Steps to reproduce
- On macOS, use
HTTPClient(eventLoopGroupProvider: .singleton)with the default configuration. - Send a request to a host whose certificate fails verification (for example
https://wrong.host.badssl.com). - Standard output contains
Trust failed: “*.badssl.com” certificate name does not match input.
Expected behavior
The library does not write to stdout.
The message carries the specific reason for the failure (expired, name mismatch, untrusted), which the NWTLSError the request fails with does not include. So rather than dropping it, it could go to the background activity logger (for example at debug level), which is already available where the TLS options are created.
Workaround
Setting tlsConfiguration.trustRoots = nil (with .fullVerification) avoids installing the verify block, so Network.framework evaluates trust itself and nothing is printed.
Environment
- async-http-client 1.36.0; the print is also present on main (6b7549b)
- macOS, NIOTransportServices
- 主要言語
- Swift
- スター
- 1.1k
- フォーク
- 159
- 平均マージ
- 18時間 43分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
swift-server/async-http-client のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
swift-server/async-http-client#946 · コメント 2 件 ·
-
RequestBag keeps the request body after an early response with status >= 300対応中かも @beshkenadze が 28 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
HTTP/2 stream stays half-closed after an early response with status >= 300対応中かも @beshkenadze が 28 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
-
Transaction keeps the request body after an early response with status >= 300対応中かも @beshkenadze が 28 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
swift-server/async-http-client の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
Ranchero-Software/NetNewsWire#5572 ·
メンテナーはふだん 11 日以内に返信
-
api beginner story
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NCSU-App-Development-Club/ios_fall_26#86 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
yetanotherbrowser/yab#1008 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100