297 Commits

Author SHA1 Message Date
Connor Welsh d50d1bba65 ssh kitten: avoid in-place mutation of cmd by slices.Insert
slices.Insert(cmd, 1, "-O", "check") writes into cmd's backing array
when there is spare capacity (cap(cmd) >= len(cmd)+2). check_cmd points
at the shifted array, but cmd's slice header is unchanged: reading
cmd[:insertion_point] later returns "-O", "check", ... where the
original prefix used to be. run_control_master, forward_remote_control,
and the final ssh exec all build their argvs from this corrupted prefix.

Repro: share_connections=yes, forward_remote_control=yes, and enough
ssh_args to push cmd past Go's slice-growth threshold (kitten ssh -v
host does it). With the ControlMaster already up you'll see
"Multiplexing command already specified"; otherwise it fails with
"Failed to start SSH ControlMaster" and a stray -O check left in the
cmdline.
2026-05-18 23:08:33 -04:00
Kovid Goyal e414483264 Sanitize ssh kitten shm open error message when sending over tty
This prevents sending attacker controlled data over the tty where it
might end up getting evaled by the shell if the user is doing something
like cat of unsanitized data into the terminal (something that should
never be done).
2026-04-24 17:25:00 +05:30
Kovid Goyal 3d8a2fbb4f Use SIMD base64 everywhere 2026-04-21 11:56:55 +05:30
Kovid Goyal 15a6a51a22 Fix RemoteCommand usage with bootstrap.py and bootstrap.sh not exiting after RemoteCommand 2026-04-15 05:37:56 +05:30
Kovid Goyal a47093a7bf ssh kitten: Fix -o RemoteCommand handling 2026-04-15 05:19:22 +05:30
zhaolei b86367483f Asynchronously read ssh configuration 2026-04-14 14:29:18 +08:00
zhaolei 9b02a59c4e Add support for RemoteCommand option in kitten ssh 2026-04-14 11:11:51 +08:00
newwares 828bd56fa5 ssh kitten: Push and pop keyboard encoding flags 2026-02-07 20:26:28 -05:00
Kovid Goyal d19fc375ba Switch to external shm package 2025-11-10 12:01:05 +05:30
Kovid Goyal aec3c82c48 ssh kitten: Fix a bug where automatic login was not working
Fixes #9187
2025-11-05 19:35:36 +05:30
Kovid Goyal 460d10902f Cleanup previous PR
The overrides were not being passed to the askpass kitten.
And we dont need to support backward compatibility for secrets with no
backend, since this feature has never been released.
2025-09-30 20:38:44 +05:30
NightWatcher d02c63ac86 ssh kitten: add optional password and TOTP auto-fill via ssh.conf
Motivation: Some environments disallow or do not reliably accept one-way
pubkey-only auth, or require keyboard-interactive password + TOTP. This adds an
optional, host-scoped automation via kitty's native askpass to reduce repetitive
manual entry while preserving the ssh kitten UX.

- Add auth_config.go to parse password/totp_* from ssh.conf by host block
- Ignore these keys in main ssh.conf parser to avoid bad-line warnings
- Pass host/user to askpass for host-aware lookup
- Auto-answer password and OTP prompts in askpass; fallback to UI otherwise

Security: Secrets in ssh.conf are plain text; users should enforce strict
permissions or avoid storing passwords if unacceptable. Only login password/OTP
prompts are auto-answered; passphrases and host key confirmations are not.

feat(ssh): add secret backend support for auth passwords and TOTP secrets

Introduce support for specifying secret backends in SSH auth config, currently supporting only the "text" backend for storing secrets directly. This allows for future extensibility while maintaining backward compatibility by treating values without a backend as "text:<value>".

The changes include new fields in AuthEntry for backends, updated parsing logic in lineHandler, error handling for invalid backends, and normalization for existing configs. A new parseBackendSecret function handles the parsing with validation.
2025-09-30 17:31:16 +05:30
Kovid Goyal ba96fa06fe Allow using defer in KittenMain 2025-09-30 11:20:37 +05:30
Kovid Goyal 7dae6e3945 ... 2025-09-30 08:40:30 +05:30
Kovid Goyal ba0cc0fa2c save_as_session: Implement saving of foreground process for remote shells run via ssh kitten 2025-08-22 21:14:33 +05:30
Kovid Goyal 1a25ca1545 Fix setting env vars in kssh cmdline that has no kitten directives 2025-08-22 20:56:41 +05:30
Kovid Goyal 62580c855b Make mypy 1.16 happy 2025-05-30 10:06:38 +05:30
Kovid Goyal 4713cc29ad make gofmt happy 2025-05-16 09:40:34 +05:30
Kovid Goyal c861259e3b Rename go module from kitty -> github.com/kovidgoyal/kitty
Makes the code more easily re-useable in other projects
2025-05-16 08:43:39 +05:30
Kovid Goyal 5683314784 Start work on quick-access-terminal kitten 2025-04-28 19:52:04 +05:30
Kovid Goyal 9068d3f925 Fix #8361 2025-02-23 18:00:38 +05:30
Kovid Goyal cf8407b8d3 ... 2025-02-09 15:10:41 +05:30
Kovid Goyal 8bf383d1c4 DRYer: Use the existing unix package stat() 2025-02-09 15:01:05 +05:30
Kovid Goyal 4b6226a160 And another incorrect use of unix.Stat_t 2025-02-09 14:24:05 +05:30
Kovid Goyal a582de98dc Fix building of kitten on other platforms 2025-02-09 14:11:14 +05:30
Kovid Goyal 2f775086b0 ... 2025-02-09 13:03:23 +05:30
Kovid Goyal 949860ff22 ssh kitten: Fix incorrect copying of data files when using the python interpreter and also fix incorrect hard link detection 2025-02-09 12:59:33 +05:30
Kovid Goyal da1626090a Update codebase to Python 3.10 using pyupgrade 2025-02-03 10:56:50 +05:30
Kovid Goyal 795bf7fb52 Dont use a global var for mocking 2025-01-05 20:58:33 +05:30
Kovid Goyal 86a6685446 Add mock for failing test 2025-01-05 20:36:32 +05:30
Kovid Goyal 2d02ff1c5f Implement using effective kitty config options for kittens
Also centralise reading of kitty options
2025-01-05 20:16:43 +05:30
Kovid Goyal c07037b558 ... 2025-01-05 12:58:34 +05:30
Kovid Goyal 334adf9c1a Ensure temp files and other resources are cleaned up even if kitty crashes or is SIGKILLed 2025-01-05 12:51:59 +05:30
Kovid Goyal 100f472a08 Clarify docs 2024-09-24 20:15:39 +05:30
Kovid Goyal 40d1781404 Fix #7688 2024-08-04 17:18:31 +05:30
Kovid Goyal 405f5ce148 Use stdlib maps/slices 2024-06-24 07:54:13 +05:30
Kovid Goyal a6c7744119 ssh kitten: Passthrough when -V is specified
Fixes #7515
2024-06-06 19:52:35 +05:30
Mike Giroux 4aeb32cc4f Trivial "It's"->"Its" fix 2024-05-27 10:44:03 -04:00
Kovid Goyal 5036b9f8a5 Fix failing test in CI 2024-05-22 08:13:59 +05:30
Kovid Goyal 61c5167554 Show stdio output from ssh if getting options fails 2024-05-22 08:05:32 +05:30
Kovid Goyal 5f809bf249 Get kitty building with the new VT parser 2024-02-25 09:57:22 +05:30
Kovid Goyal a1f2a7df4d Port new shlex code to Go 2023-12-04 14:14:11 +05:30
Kovid Goyal 77292a16d6 Make shebangs consistent
Follow PEP 0394 and use /usr/bin/env python so that the python in the
users venv is respected. Not that the kitty python files are meant to be
executed standalone anyway, but, whatever.

Fixes #6810
2023-11-11 08:32:05 +05:30
Kovid Goyal 8dfe1fcca9 Ensure clenup is run even when ssh child is killed by interrupt 2023-11-06 22:02:06 +05:30
Kovid Goyal bd5fcb00e0 Fix regression that broke quick exit from ssh kitten 2023-11-06 21:22:41 +05:30
Kovid Goyal bc1da5525e ssh kitten: Fix restore state not being called after interrupt 2023-11-05 08:38:04 +05:30
Kovid Goyal d113a6c2cf ssh kitten: Fix a regression that broken ctrl+space mapping in zsh
Fixes #6780
2023-11-03 07:16:07 +05:30
Kovid Goyal 0300a355d0 update docs for remote_kitty 2023-10-18 17:31:44 +05:30
Kovid Goyal b21bbbe14c Fix ssh kitten override parsing ignoring settings inherited from ssh.conf
Fixes #6639
2023-09-20 09:15:38 +05:30
Kovid Goyal 18e5b74699 More linter fixes 2023-09-20 08:43:50 +05:30