loopdb: postgres password with URL-reserved characters breaks the connection
メンテナーはふだん 7 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
PostgresConfig.DSN から始めて、現在の DSN がどのように組み立てられ、ログに記録されているかを確認します。URL で予約されている文字を含むパスワードについて、要求されたテーブル駆動のテストカバレッジを追加し、net/url で結果をパースする処理も含めて、関連する Go テストを実行します。パースされたユーザー、パスワード、ホスト、データベースが、IPv6 ホストの処理を含めて変更されないことが完了の条件です。
索引モデルが issue の本文から書いたものです。
説明
Title: loopdb: postgres password with URL-reserved characters breaks the connection
Background
PostgresConfig.DSN builds the connection string with fmt.Sprintf, putting the user and password into the URL without escaping them:
dsnTemplate = "postgres://%v:%v@%v:%d/%v?sslmode=%v"
pgx parses this string with net/url, so any URL-reserved character in the password changes how the URL is parsed. For example, / ends the authority section early, so with --postgres.password=ab/cd the string becomes:
postgres://loop:ab/cd@localhost:5432/loop?sslmode=disable
This parses as host loop:ab and path /cd@localhost:5432/loop, so loopd fails to connect. #, ? and % cause similar failures.
Passwords made with common tools such as openssl rand -base64 often contain /. #1088 adds a way to read the password from a file, which encourages exactly this kind of generated password, so this is likely to come up more often.
Proposed fix
Build the DSN with net/url so each part is escaped correctly:
dsn := url.URL{
Scheme: "postgres",
User: url.UserPassword(s.User, password),
Host: net.JoinHostPort(s.Host, strconv.Itoa(s.Port)),
Path: s.DBName,
RawQuery: url.Values{"sslmode": {sslMode}}.Encode(),
}
net.JoinHostPort also brackets IPv6 host literals correctly, which the current template doesn't do. The hidePassword placeholder used when logging stays as it is.
Add a table-driven test for DSN that runs passwords containing /, @, :, #, ?, % and spaces through url.Parse and checks that the user, password, host and database come back unchanged.
- 主要言語
- Go
- スター
- 593
- フォーク
- 138
- 平均マージ
- 4日 9時間
- マージ済み PR(30日)
- 14
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
lightninglabs/loop のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 50/100
lightninglabs/loop#1208 · コメント 1 件 ·
メンテナーはふだん 7 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
lightninglabs/loop#1196 ·
メンテナーはふだん 7 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
lightninglabs/loop#1172 ·
メンテナーはふだん 7 日以内に返信
-
Track armed static address HTLCs after aborted swaps再び着手できるかも @hieblmi が 104 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
lightninglabs/loop#1171 · 担当者 1 名 ·
メンテナーはふだん 7 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
lightninglabs/loop#1170 ·
メンテナーはふだん 7 日以内に返信
lightninglabs/loop の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
grafana/tempo-operator#1691 ·
メンテナーはふだん 1 日以内に返信
-
fix: presentation.go with mcp-table.go: the message for each MCP server comes back対応中かも @mge1512 が今日担当しました。 オープンbug
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
mark3labs/kit#242 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
slavakurilyak/awesome-ai-agents#827 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug P3
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mpyw/declscope#262 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信