fix(shell): 1Password セッション失効時に fnox が secret の数だけ認証ダイアログを出すのを防ぐ - #67
Merged
Conversation
fnox は age provider の identity (1Password 参照) を secret ごとに毎回・ 並列に解決するため、セッション失効中に fnox を実行すると op プロセスが secret の数だけ spawn され、同一の認証ダイアログが並んで出る。 FNOX_PROMPT_AUTH=false は fnox 自身の auth_command 確認プロンプトを 抑止するだけで、op の認証ダイアログは防げない。 - fish/zsh/bash の hook: 失効時は hook-env を実行せず本当にスキップする - fish の fnox wrapper: op signin 失敗時は本体を実行せず中断する - __fenv_load_fnox: 事前認証を fnox wrapper に一本化する - zsh/bash: signin 失敗のラッチ時に一度だけ stderr へ通知する (fish と統一) これで認証は明示実行時の op signin 1 回に集約される。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
1Password セッション失効中に fnox を実行すると、同一の認証ダイアログが secret の数だけ並んで出る問題を修正する。
原因 (jdx/fnox v1.29 のソースで確認): fnox の age provider は
identity = { provider = "onepass", ... }のネスト参照を secret ごとに毎回・並列 (get_secrets_concurrent, 最大 10 並列) に解決するため、失効中は独立したop readプロセスが secret の数だけ同時 spawn され、それぞれが認証ダイアログを要求する。従来の失効時フォールバックFNOX_PROMPT_AUTH=falseは fnox 自身の auth_command 確認プロンプトを抑止するだけで、op の認証ダイアログには効かない (しかも外側 provider が age で auth_command 未定義のため、そのプロンプト自体が元々発火しない)。変更内容
__fnox_env_eval/_fnox_hook): 失効時はfnox hook-envを実行せず本当にスキップする (FNOX_PROMPT_AUTH=falseでのフォールバック実行を廃止)fnoxwrapper:op signin失敗時は本体を実行せず中断する (command fnoxでの強制実行を案内)__fenv_load_fnox: 事前認証の分岐を廃止し、fnoxwrapper に一本化するこれで認証は「明示的に fnox / fenv を実行した瞬間の
op signin1 回」に集約され、成功後の並列op readはセッション有効のため無音で通る。関連 Issue
なし
動作確認
mise run pre-commitが通ったmise run testが通った (sandbox 起因の既知の偽失敗を切り分けのうえ 46/46 パス)mise run dry-runで意図した差分のみであることを確認した (変更 4 ターゲットにスコープして実行)追加の実地確認:
fish -n/zsh -n/bash -nの構文チェックop whoami1 回のみ) ことを観測typeset -f/declare -fで適用後の関数定義からフォールバック分岐が消えたことを確認チェックリスト
補足情報
挙動変更のトレードオフ: 失効中は hook-env 自体を実行しなくなるため、失効前に読み込んだ env の掃除 (unset) も失効中は行われない。この構成では全 secret が 1Password に推移的に依存しており失効中は正しい値を読めないこと、signin 成功時に wrapper が
__fnox_env_evalで即再読込することから許容と判断。根本原因である fnox 側の age identity 非メモ化 (secret ごとの並列解決) は upstream (jdx/fnox) の問題で、別途 issue 起票候補。