unleash: Create dereferences a nil response when bifrost returns any non-201
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 76/100
調査の方向性
internal/unleash/queries.go の Create から始め、次に internal/unleash/models.go の bifrostUnleashToK8s と toUnleashInstance を調べます。409 と 500 のレスポンスのカバレッジを追加し、201 以外のレスポンスがエラーを返すこと、409 を区別できること、nil の変換で panic が発生しないことを確認します。
索引モデルが issue の本文から書いたものです。
説明
Summary
unleash.Create never checks bifrost's HTTP status. The generated client returns err only for transport failures, so any non-201 response leaves resp.JSON201 nil, and the nil flows into toUnleashInstance, which dereferences it.
Severity: low today, rising — see "Why this has not bitten yet"
Component: internal/unleash/queries.go (Create), internal/unleash/models.go:221 and the toUnleashInstance below it
Mechanism
resp, err := client.CreateInstance(ctx, req)
if err != nil {
return nil, err // transport errors only
}
unleashInstance := bifrostUnleashToK8s(resp.JSON201) // nil for any non-201
…
return toUnleashInstance(unleashInstance), nil // dereferences u.Spec
bifrostUnleashToK8s guards nil and returns nil (models.go:222-224), but toUnleashInstance starts with for _, env := range u.Spec.ExtraEnvVars with no guard.
Reachable bifrost responses today: 400 validation_failed, 400 no_version_source, 500 creation_failed.
Why this has not bitten yet
Loki, 14 days of bifrost traffic: 2985 GET /v1/releasechannels, 15 PUT /v1/unleash/{name}, and zero POST /v1/unleash. Instance creation is essentially never exercised, so the path has not been hit. No matching panic appears in nais-api's logs over the same window.
Why it is worth fixing now
nais/bifrost#549 adds two new create responses — 409 already_exists when the instance already exists, and 503 when the existence check is inconclusive. The 409 in particular is raised on a duplicate POST, which is the one non-exotic way to hit a non-201. It converts a rare data-loss path in bifrost into a nil dereference here.
Proposed fix
Check the status before converting, and map bifrost's error responses to sensible GraphQL errors — at minimum 409 should surface as "an Unleash instance already exists for this team" rather than an internal error. A nil guard in toUnleashInstance is worth having regardless, as defence in depth.
Acceptance criteria
- A non-201 from bifrost returns an error, not a nil dereference.
- 409 surfaces a distinguishable "already exists" message.
-
toUnleashInstancetolerates nil. - Test covering at least the 409 and 500 responses.
- 主要言語
- Go
- スター
- 3
- フォーク
- 2
- 平均マージ
- 17時間 37分
- マージ済み PR(30日)
- 31
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nais/api のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
Provide one paginated connection for workloads without usable vulnerability data再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
Valkey filterオープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
component/gpu-kubelet-plugin component/helm needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
kubernetes-sigs/dra-driver-nvidia-gpu#1559 ·
メンテナーはふだん 1 日以内に返信
-
TOTP enrollment returns 500 for phone-only users (empty TOTP account name)対応中かも @emiliosandoval4 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
メンテナーはふだん 1 日以内に返信
-
8.9 to 8.10 Helm upgrade guide still says deprecated keys are removed in chart v16 (Camunda 8.11)オープン
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
camunda/camunda-platform-helm#7559 ·
メンテナーはふだん 1 日以内に返信
-
docs: namespaceRegexes example teaches prefix matching, but regexes are matched as a substring対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンtriage/pending-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
external-secrets/external-secrets#7117 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ENTERPILOT/GoModel#1183 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信