KeiSeiKit-1.0/install
Parfii-bot 8473b4ae80 fix(hooks+install): disk-reclaim Guard 3 + secrets per-line + sha256 fail-closed
Three independent shell hardening fixes from Opus Shell + Sonnet Shell audits.

1. disk-reclaim.sh Guard 3 — protect branches without upstream tracking (HIGH)
   File: hooks/disk-reclaim.sh:88-101
   Bug: when a worktree branch has no upstream tracking ref, `git log @{u}..`
   exited non-zero and `unpushed=""` (empty). The check
   `[ -n "$unpushed" ] && [ "$unpushed" != "0" ]` evaluated FALSE, so the
   worktree fell through Guard 3 and was eligible for mtime-based pruning.
   Local-only branches with committed work were silently deleted.

   Fix: explicit two-branch logic. Run `git rev-parse --abbrev-ref @{u}` first;
   only run the unpushed-count check if upstream exists. If no upstream, log
   SKIP[no-upstream] and `continue` conservatively. New
   `worktrees_skip_unpushed` counter increments in both unpushed paths.

2. secrets-pre-guard.sh — placeholder allowlist scope-narrow (MEDIUM)
   File: hooks/secrets-pre-guard.sh:43-103
   Bug: word "placeholder" anywhere in content disabled all secret-pattern
   scanning for that whole Write. Allowlist was too broad — a doc with the
   word "placeholder" in its prose could mask a real sk-ant- token elsewhere.

   Fix: replaced global early-exit with per-line awk scan. New scan_pattern()
   helper walks content line-by-line; each line matching a secret regex is
   allowed ONLY if the SAME line also matches ALLOWLIST_RE. Doc prose can no
   longer mask cross-line secrets. Added `dummy[_-]?(key|token|secret)` to
   allowlist for legitimate test fixtures.

3. lib-rust-prebuild.sh — sha256 fail-closed (HIGH supply-chain)
   File: install/lib-rust-prebuild.sh:75-88
   Bug: when ${url}.sha256 404'd, installer printed WARNING and proceeded with
   unverified tarball. A compromised github release uploader could ship a
   malicious tarball, omit .sha256, and the installer would extract it into
   ~/.cargo/bin/.

   Fix: missing .sha256 → ERROR + abort. Path A install fails → falls back to
   Path B (cargo build from source). Override via KEI_ALLOW_UNVERIFIED_TARBALL=1
   (visible per-call, intentional friction).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 15:37:57 +08:00
..
launchd-templates KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-agents.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-args.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-backup.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-bin.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-bridges.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-dev-hub-datasette.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-dev-hub-daytona.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-dev-hub-forgejo-runner.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-dev-hub-forgejo.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-dev-hub-gdrive-import.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-dev-hub-mdbook.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-dev-hub-restic.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-dev-hub-zoekt.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-frustration-bootstrap.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-hooks.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-launchd.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-log.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-menu.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-pathway.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-plan.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-prereqs.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-primitives.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-profile.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-rust-mirror.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-rust-prebuild.sh fix(hooks+install): disk-reclaim Guard 3 + secrets per-line + sha256 fail-closed 2026-05-03 15:37:57 +08:00
lib-rust.sh feat(install): Rust binary acquisition for fresh-clone installs (Path A + Path B) 2026-05-01 19:07:55 +08:00
lib-scaffold.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-skills.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-substrate.sh chore(kit): wire kei-db-contract into installer + drop final #[path] hack 2026-05-01 17:55:52 +08:00
lib-summary.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
lib-wizard.sh KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00