Skip to content

feat: forgejoの認証情報をpass-git-helper経由で記憶する#1297

Merged
ncaq merged 6 commits into
masterfrom
pass-git-helper
Jun 27, 2026
Merged

feat: forgejoの認証情報をpass-git-helper経由で記憶する#1297
ncaq merged 6 commits into
masterfrom
pass-git-helper

Conversation

@ncaq

@ncaq ncaq commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Forgejoに対するgit pushなどのHTTPS操作でユーザ名とトークンを毎回聞かれずに済むよう、
pass-git-helperをcredential helperとして組み込みます。

トークン自体はsopsで暗号化したものを正本としてsecrets/forgejo.yamlに長期保存し、
home-managerのactivationで内容に変化があった時だけpassのエントリへ再暗号化して配置します。
これによりトークンの管理はsopsとgitで完結しつつ、
日常の認証はGUIやlibsecret連携の豊富なpassエコシステムに乗せられます。

git側ではForgejoのエンドポイントに対してuseHttpPath = falseusername = ncaqを指定し、
ホスト単位でhelperを引かせます。
helperの問い合わせマッピングはpass-git-helperの設定ファイルで定義します。

@ncaq ncaq added the Type: Feature New Feature label Jun 27, 2026
@ncaq ncaq self-assigned this Jun 27, 2026
@github-actions

Copy link
Copy Markdown

nvd diff: seminar (base: master)

Version changes

Added packages

  • [A.] #1 forgejo.yaml <none>
  • [A.] #2 hm_passgithelpergitpassmapping.ini <none>
  • [A.] #3 pass-git-helper 4.3.0
    Closure size: 4975 -> 4978 (17 paths added, 14 paths removed, delta +3, disk usage +99.0KiB).

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgejoの認証情報をpass-git-helper経由でpassに記憶させる構成です。トークンをsopsで正本管理しつつactivationで内容変化時のみpassへ再暗号化配置する設計、credential helperをnixストア絶対パスで固定する点、pass-git-helperの依存追加(上流v4.3.0で活発に保守、軽量なPythonアプリ)はいずれも妥当です。

ただし1点だけ確実に修正すべき問題があります。last-commit.jsonが誤ってコミットされています。これは.gitignore/last-commit.jsonとして登録されたinstall.shのrebuild時一時ファイルであり、恒久的にコミットされるとflake評価が古いコミット情報を参照する温床になります。git rm --cached last-commit.jsonで除外してください。

そのほかactivationスクリプトの復号エラーの扱い(冪等性)についてWARNINGを1件、パーミッションやコメント正確性などのNOTE/TIPを添えています。

Review metadata
  • Reviewed commit: bd6418e
  • PR: #1297
  • kyosei: 3.5.0
  • kyosei-action: 2.2.5
  • Claude Code: 2.1.174
  • Model: claude-opus-4-8
  • Execution: GitHub Actions (run)

Comment thread last-commit.json Outdated
Comment thread home/core/pass.nix
Comment thread home/core/pass.nix
Comment thread home/core/pass.nix
Comment thread home/core/git.nix
Comment thread home/core/pass.nix
定義が一部重複しているのはツールがどこから呼ぶかバラバラなので仕方がない。
@ncaq ncaq force-pushed the pass-git-helper branch from bd6418e to a69bae5 Compare June 27, 2026 10:58

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前回レビュー (commit bd6418e, CHANGES_REQUESTED) で唯一のブロッカーだった last-commit.json の誤コミットは、現在のhead a69bae5 のツリーから除去済みで、master・head いずれにも含まれていないことを確認しました。当該スレッドもoutdated扱いになっています。

また home/core/pass.nix / home/core/git.nix に付いていた指摘 (activationの冪等性と復号失敗の握り潰し、再暗号化先のパーミッション、条件判定部の $DRY_RUN_CMD、helperの $@ クォート、コメントの責務記述) はすべてncaqによりresolved済みです。

今回の追加コミットで入った credential."https://forgejo.ncaq.net"helper / useHttpPath = false / username = ncaq と、pass-git-helper 側マッピング ([forgejo.ncaq.net*] / target / username) は整合しており、ホスト単位でhelperを引かせる構成として妥当です。pass-git-helper 4.3.0 の依存追加も軽量 (closure +99KiB) で、上流は活発に保守されています。

設計面 (sopsを正本に内容変化時のみpassへ再暗号化、credential helperをnixストア絶対パスで固定) も健全で、新規に修正を要する問題は見つかりませんでした。前回のブロッカー解消を確認できたためAPPROVEします。

Review metadata
  • Reviewed commit: a69bae5
  • PR: #1297
  • kyosei: 3.5.0
  • kyosei-action: 2.2.5
  • Claude Code: 2.1.174
  • Model: claude-opus-4-8
  • Execution: GitHub Actions (run)

@ncaq ncaq enabled auto-merge June 27, 2026 11:05
@ncaq ncaq merged commit 6bdcdce into master Jun 27, 2026
10 checks passed
@ncaq ncaq deleted the pass-git-helper branch June 27, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant