init and serve leave an existing TLS private key readable by other users

オープン 初心者向け
#769 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
security

調査の方向性

crates/app/src/serve_helpers.rs(77行目付近)の check_config_permissions から始めてください。この関数はすでに警告を出し、設定を0600に設定しています。server.tls.key_path にも同じことを行ってください。init でスキップされる経路は crates/app/src/init_helpers.rs の generate_tls_cert_if_needed です。0644の鍵から始まるテストで警告が表示され、最終的に鍵が0600になれば、serve と init の両方で完了です。

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

説明

bug security

Problem

Neither init nor serve checks the mode of an existing TLS private key, so a key.pem that other users can read stays readable.

  • init skips certificate generation when both cert.pem and key.pem exist (generate_tls_cert_if_needed, crates/app/src/init_helpers.rs). It checks that the certificate covers the requested names and does not look at the key's mode.
  • serve checks only the config file's mode: check_config_permissions (crates/app/src/serve_helpers.rs line 77) warns and sets the config to 0600 when group or other bits are set. Read from the code, nothing does the same for server.tls.key_path (default ~/.extenddb/tls/key.pem).

A key ends up wider than 0600 when an older init stopped between writing the key and setting its mode (#709, fixed in #766 for new keys), or when an operator copies a key in with the umask mode.

Measured

2 November 2026, a build of #766 (7cb517498), a fresh HOME, umask 022. init created key.pem at 0600. After chmod 0644 key.pem, a second init with a new config path and a new SQLite path printed --- TLS certificate already exists, skipping generation., exited 0, and left key.pem at 0644.

Expected

Treat the key file as check_config_permissions treats the config: when server.tls.key_path has group or other bits set, serve warns and sets it to 0600, and the init skip path does the same for ~/.extenddb/tls/key.pem. A test starts from a 0644 key and checks the warning and the 0600 result.

主要言語
Rust
スター
517
フォーク
60
平均マージ
5日 4時間
マージ済み PR(30日)
76

環境構築

はじめの一歩

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

ExtendDB/extenddb のほかの issue

ExtendDB/extenddb の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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