Trust user-installed CA certificates (self-hosted servers behind a private CA)

オープン
#317 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
50/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android, kotlin
領域
mobile, security

調査の方向性

The trust configuration lives in app/src/main/res/xml/network_security_config.xml, whose base-config has no trust-anchors element. Check that the manifest points to this file, then read how the app builds its HTTPS client for server pairing. The maintainer has not chosen between the three options, so confirm the approach in the thread before editing. Done means a user-installed CA is accepted when pairing with a server behind a private CA.

索引モデルが issue の本文から書いたものです。

説明

Problem

Pairing with an OpenCode server whose TLS certificate is signed by a private root CA
fails with -1202 serverCertificateUntrusted, although the root CA is installed on the
device (Settings → Security → Encryption & credentials → Trusted credentials → User).
Chrome on the same device opens the same URL without any certificate warning, so the
CA, the certificate chain and the SAN are all valid.

This is a common setup for self-hosted servers: a reverse proxy (nginx here) with a
certificate from a personal CA, reachable on the local network.

Environment
  • App: OpenCode 0.8.6 (1015), installed from Google Play
  • Server: nginx 1.27 terminating TLS in front of OpenCode, certificate signed by a private
    root CA (RSA 2048, SHA-256, SAN matches the hostname, full chain served)
Error
URLError -1202 serverCertificateUntrusted · https://<host>:<port>
Phase: Pair
Message: Couldn't reach the OpenCode server
Cause

app/src/main/res/xml/network_security_config.xml only sets
<base-config cleartextTrafficPermitted="true" /> without <trust-anchors>.
On Android 7+ this means only system CAs are trusted; user-installed CAs are ignored.

Possible solutions

Any of these would solve it:

  1. Trust user CAs in the network security config (smallest change):
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </base-config>
    
  2. A toggle in Settings, e.g. "Trust user-installed certificates", off by default.
    Since the network security config is static, this would need an OkHttp
    X509TrustManager that combines the system store with the user CAs
    (AndroidCAStore) when the toggle is on.
  3. Importing a root CA in the app, e.g. per server under Edit Server, stored in
    the app's own trust store. This works without installing the CA system-wide and
    limits trust to that one server.

Option 1 matches what Chrome already does; options 2 and 3 give users more explicit
control.

主要言語
Kotlin
スター
146
フォーク
35
平均マージ
7時間 41分
マージ済み PR(30日)
221

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode-android のほかの issue

anomalyco/opencode-android の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。