Skip to content

core: resolve kit root from installed layouts (fix "Could not find phishkit root" flood) - #26

Merged
adamsiwiec1 merged 1 commit into
mainfrom
fix/kit-root-installed-layout
Oct 26, 2026
Merged

adamsiwiec1 merged 1 commit into
mainfrom
fix/kit-root-installed-layout

Conversation

@adamsiwiec1

Copy link
Copy Markdown
Contributor

Problem

After brew upgrade to alpha.6, the desktop Activity log floods with Could not find phishkit root. Set PHISHKIT_ROOT to the kit directory. The cask ships only the Tauri .app binary (and the CLI tarball ships only the binaries) — neither contains the kit/ tree. kit_root() only looked at the Cargo-manifest dir (dev-only) and the executable's parent dirs, none of which hold kit/evilginx/phishlets on an installed machine, so it always failed.

This PR (resolution half)

Extends kit_root() to also discover installed layouts:

  • macOS .app resources: <exe>/../Resources and ../Resources/kit-root (Tauri bundle.resources), plus ../share/phishkit
  • Homebrew/standard prefixes ($HOMEBREW_PREFIX, /opt/homebrew, /usr/local) → share/phishkit[/kit-root]
  • Application Support (com.phishkit.phishkit/com.phishkit.app)/kit-root, and ~/.phishkit

PHISHKIT_ROOT still takes priority. Also fixes validate_kit_root (it checked kit/evilginx/phishlets twice instead of falling back to legacy evilginx/phishlets). Tested: cargo test -p phishkit-core kit (3 pass), clippy clean.

Still required to fully close the fire (packaging half — needs a release build to validate)

This PR makes the app look in the right places; a release must ship the kit tree to one of them. Recommended:

  1. Desktop: stage kit/ (incl. built kit/evilginx/run/evilginx) + vendor/community-phishlets into apps/desktop/src-tauri/kit-root/ during the desktop job, add "resources": ["kit-root/**/*"] to tauri.conf.json → lands at Contents/Resources/kit-root/ (no _up_ mangling), which this PR's ../Resources/kit-root candidate finds.
  2. CLI: build evilginx in the cli job (per-target GOARCH) and ship a kit-root/ dir in the tarball; have the phishkit-cli cask install it to #{HOMEBREW_PREFIX}/share/phishkit/kit-root.
  3. Ensure phishkit cask depends_on phishkit-cli resolves to the same version (currently reported "1 missing").

I did not commit the CI/bundle changes here because I can't build/validate the .dmg/tarball in this environment and a broken bundle step would break the release pipeline. A new release tag is required for either half to reach brew users.

Interim: launchctl setenv PHISHKIT_ROOT <dev-checkout> + relaunch unblocks the desktop app now.

A brew-installed desktop app (or CLI) has no kit/ tree on the Cargo-manifest
or dev path, so kit_root() failed with "Could not find phishkit root" and the
Activity log flooded. Extend resolution to also check installed layouts:

  - macOS .app bundle resources: <exe>/../Resources and ../Resources/kit-root
    (Tauri bundle.resources), and ../share/phishkit beside the binary
  - Homebrew/standard prefixes: $HOMEBREW_PREFIX, /opt/homebrew, /usr/local
    -> share/phishkit[/kit-root]
  - macOS Application Support (com.phishkit.phishkit / com.phishkit.app)/kit-root
  - ~/.phishkit

PHISHKIT_ROOT still wins. Also fix validate_kit_root, which checked the modern
kit/evilginx/phishlets path twice instead of falling back to the legacy
evilginx/phishlets layout. Added tests (legacy layout + homebrew-share
candidate). NOTE: this is the resolution half — a release must also *ship*
the kit tree into one of these locations (see PR body).
@adamsiwiec1
adamsiwiec1 merged commit effa8d8 into main Oct 26, 2026
5 checks passed
@adamsiwiec1
adamsiwiec1 deleted the fix/kit-root-installed-layout branch October 26, 2026 11:25
adamsiwiec1 added a commit that referenced this pull request Oct 26, 2026
…lves without PHISHKIT_ROOT

Resolver half (PR #26) taught kit_root() to look in installed layouts, but
nothing shipped the kit tree there, so brew installs still flooded 'Could not
find phishkit root'. This ships it:

- scripts/stage_kit_root.sh: stages a valid kit root (kit/, built evilginx
  binary, redirectors, community phishlets, top-level scripts, Makefile the
  shell harness sanity-checks for), excluding runtime state/caches. Portable
  cp -R (macOS CI runs openrsync).
- Desktop: tauri.conf bundle.resources 'kit-root/**/*' -> Contents/Resources/
  kit-root/, which the resolver's ../Resources/kit-root candidate finds. CI
  stages it after building evilginx.
- CLI: release.yml cli job now installs Go, builds evilginx per-target
  (GOOS/GOARCH from the triple), and stages kit-root/ inside the tarball;
  kit.rs resolves a kit-root/ sibling of the executable (cask symlinks resolve
  back into the staged dir).
- Bump 0.1.1-alpha.6 -> 0.1.1-alpha.7.

cargo test (38 pass) + clippy clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant