Validate API key and model availability at connection time
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- go, postgresql
- 領域
- api, authentication, backend
調査の方向性
Read auth.go:17-139 to understand authentication and startup messaging, then inspect connection.go around lines 113-117 where the LLM client is created before the query loop. Trace the LLMClient implementations for OpenAI and Anthropic and determine how validation and PostgreSQL FATAL errors should be handled. Done means connections reject invalid keys or unavailable models before queries, with the documented error codes.
索引モデルが issue の本文から書いたものです。
説明
Problem
The authenticate function (auth.go:17-90) performs the PostgreSQL password
handshake - receives the StartupMessage, requests the cleartext password, and
returns the extracted credentials (provider, API key, model, options). It does
no validation.
Separately, sendStartupMessages (auth.go:93-139) sends AuthenticationOk and
startup parameters to the client - also with no validation.
Between these two calls and the query loop, nothing verifies that the API key
is valid or the model exists. The user only finds out on their first query
when the LLM API call fails.
Proposed solution
Add a Validate(ctx) error method to the LLMClient interface. Call it in
connection.go after creating the LLM client (line ~113) and before entering
the query loop (line ~117).
Each provider implements validation differently:
- OpenAI:
GET /v1/modelsor a minimal completion call - Anthropic: minimal message call or equivalent
On failure, send a PostgreSQL FATAL error and close the connection:
- Invalid API key →
FATAL 28P01 (invalid_password) - Invalid/unavailable model →
FATAL 3D000 (invalid_catalog_name)
Considerations
- Adds latency to every new connection - should use the cheapest possible API call
- Could be opt-out via a flag (
-skip-validation) for local/trusted setups
- 主要言語
- Go
- スター
- 40
- フォーク
- 2
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
[Docs] - Document minimum Terraform/OpenTofu version (>= 1.11) required by write-only argumentsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
MagaluCloud/terraform-provider-mgc#323 ·
メンテナーはふだん 11 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
rossoctl/context-guru#366 ·
メンテナーはふだん 1 日以内に返信
-
stage-fail
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
siyuan-note/bazaar#2293 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
piraeusdatastore/piraeus-operator#1070 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信