Files
sessions/rust/crates/sessions_askpass/Cargo.toml
Myeongseon Choi b26b32fcf1 feat(rust): native sessions_askpass.exe + revert v0.7.2's BatchMode=yes hotfix
The v0.7.2 BatchMode=yes hotfix gave up password / keyboard-interactive
auth on Windows because OpenSSH's posix_spawnp shim couldn't load our
.cmd askpass via CreateProcessW. That isn't acceptable when password
is the only auth method available on the remote host. This change
restores password auth by replacing the .cmd with a native PE binary
that CreateProcessW can actually spawn.

New Rust crate sessions_askpass:
- src/main.rs implements the existing prompt-bridge protocol unchanged
  (argv[1] = prompt; SESSIONS_ASKPASS_REQUEST/RESPONSE/CANCEL env vars
  drive the rendezvous), with atomic prompt write, bounded poll loop
  (default 120s timeout, override via SESSIONS_ASKPASS_TIMEOUT_SECS),
  and best-effort cleanup of consumed files
- 7 unit tests cover timeout parsing, prompt write atomicity, and the
  three poll outcomes (response / cancel / timeout)
- builds cleanly under cargo build --release --workspace for both
  linux x86_64 and windows-gnu

Sublime integration:
- _materialize_bridge_askpass_executable: on Windows resolves the
  native sessions_askpass.exe and points SSH_ASKPASS at it; on posix
  the shell-script path is unchanged. Falls back to .cmd write on
  Windows when the binary isn't built so the failure stderr stays
  diagnostic instead of silently no-op.
- _resolve_sessions_askpass_binary_path: searches shipped sessions/bin
  per-platform-tag dirs, then cargo target/debug, then target/release
  (mirrors the local_bridge discovery pattern).
- _local_ssh_argv: drops the v0.7.2 BatchMode=yes Windows branch — back
  to BatchMode=no everywhere now that the askpass actually works.
- service_popen_with_prompt_bridge: extracted from
  _run_ssh_remote_command_with_prompt_bridge so the helper-binary push
  / probe paths in ssh_file_transport.py share the same servicing loop
  without the simple-text-stdin assumption that helper baked in.
- _needs_remote_session_helper_push and _push_session_helper_via_ssh
  spawn ssh via Popen + service_popen_with_prompt_bridge when an
  askpass dir is in scope (env carries SESSIONS_ASKPASS_REQUEST).
  Without that infrastructure they fall back to subprocess.run, which
  is what the unit tests still exercise.
- _ssh_auth_failure_hint: rewrote to surface a platform-agnostic hint
  covering password + keys + agent, plus a breadcrumb about rebuilding
  sessions_askpass when the spawn-failure stderr shape shows up on a
  stale checkout.

Tests:
- 5 Sublime tests for the new helper functions
  (_materialize_bridge_askpass_executable: posix script-write,
  Windows-with-resolved-exe, Windows-fallback; _resolve_sessions_askpass:
  cargo release-build discovery, nothing-built returns None)
- Updated 3 ssh_file_transport hint tests for the platform-agnostic
  message and the new ssh_askpass: posix_spawnp recovery hint

1176 sublime tests + Rust workspace tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 15:03:26 +09:00

20 lines
421 B
TOML

[package]
name = "sessions_askpass"
version.workspace = true
edition.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
description = "PE binary that brokers SSH_ASKPASS prompts back to the Sessions plugin via filesystem rendezvous."
[lints]
workspace = true
[[bin]]
name = "sessions_askpass"
path = "src/main.rs"
[dev-dependencies]
tempfile = "3"