Lokyr
Documentation

Security and robustness

On this page

A terminal sees everything that is typed and printed, passwords included. That makes security a property of the whole project, not a separate module.

Threat model

What we defend againstExample
Untrusted outputA file or a remote host that prints malicious escape sequences (cat, ssh, curl)
Malicious pasteText copied from a web page that hides commands or escape sequences
Third-party pluginsA plugin trying to read the screen, the clipboard or the network without permission
Tampered packagesAn archive altered on the CDN, or a compromised publisher account
Local processesA process of another account trying to drive the terminal through the IPC socket
AI agentsAn agent that reads output it cannot trust, and is told by it to type into another pane through the MCP server (prompt injection)
The update channelA feed or a DMG altered on its host, or a signing key stolen, to install another app over Lokyr's

Out of scope: a process running as the same account with full privileges. It could read the terminal's memory anyway.

Terminal defaults

FeatureDefaultWhy
Clipboard read (OSC 52 with ?)Off; [clipboard] read = "ask" asks with an alert at each read, whose default button refusesA remote program could read the clipboard
Clipboard write (OSC 52)On, up to 1 MiBtmux, Neovim and similar tools need it over ssh
Title report (CSI 21 t)OffThe classic way to inject text into the shell's input
Rectangle checksums (DECRQCRA)Off; test suites such as esctest turn them on, as iTerm2 asksA program could read, a cell at a time, what others showed on the screen
Window operations (XTWINOPS 1 to 4 t, 8 to 11 t, 13 t, 15 t and 19 t, DECSLPP, DECSNLS, DECCOLM)Off, which is stricter than xterm: its disallowedWindowOps lets programs move and resize the window, and read these reports, by default, and DECCOLM needs only mode 40, which programs set themselvesA program could resize, move or iconify the window at will, clear the screen with DECCOLM, and learn where the window is and how large the display is; with the operations on, a side that changes takes 1000 cells at most
Report repliesWell-formed data only, never program-controlled textPrevents injection through replies
Pasted textControl characters stripped, ESC and the rest of C0, DEL and C1, except tab and line breaks, with or without bracketed pasteStops a paste from ending bracketed paste from the inside (\e[201~), or from sending ESC to an editor
A paste of several lines into a program that does not ask for bracketed pasteAsks for confirmation, with the text's first lines as the program would get them; a single line with a line break after it pastes without the line break. [clipboard] confirm-paste asks always, or neverAvoids running commands by accident, as a line break reaches the program as Return
Links: OSC 8 hyperlinks, and the URLs and the paths of the texthttp, https, mailto and file only, checked by the host for every plugin (a key of the config to change them comes later); a file URL of another machine refused; a URL or a file asks first, showing its target in full, unless [links] says otherwise; opened with ⌘-click, the link that would open underlined under the pointer while ⌘ is held, and the target shown on hover later in F3; a file that would run rather than open, as a program, an application, an installer, or a file that a terminal or another runner of documents would open, shown in the Finder, selected, as the file that a symbolic link or an alias leads to; decided in the portable layer, app-core, from what the platform tells of the target, and decided again as a question's answer comes, the platform's own open refusing a program tooNo schemes that launch other apps, and no click that runs a program that the screen named
What the system opens with Lokyr as the default terminal: ssh and x-man-page links, scripts and executablesNothing until Lokyr › Make Lokyr the Default Terminal is chosen, which macOS confirms. An ssh link, which any web page can give, runs ssh, as the app's PATH finds it, of the link's port, of digits alone, then -- and its user and host, each of the characters of a name, letters, digits, ., _ and -, not from - or ., or an IPv6 address in brackets, never through a shell; a link of anything else opens nothing. A man page's link opens its page as Open man Page does, of a page's name alone. A script runs in the login shell of its path in single quotes, exec of it where it is executable, else of the interpreter that its first line or its extension names, each word in single quotes; a path or a word of a backslash, ! or a control character, which a shell might read otherwise (tcsh and csh read ! even in single quotes), does not run, of a notice; a file of no script's extension runs only if it is executable or its first line is #!. A script of macOS's quarantine attribute, a download's, of no approval of Gatekeeper's, runs only once Lokyr's question is answered RunNo link that runs an option of ssh, as -oProxyCommand, or a shell's command; no downloaded script that runs without a question
Notifications from sequences (OSC 9, 777, 99)Only when the window is not focused, one every 2 seconds for each window at most, their title and text cut at 256 and 2,048 charactersAvoids spam
OSC/DCS/APC payloadsSize limits per type, 64 KiB, and per OSC command where one needs more, 1 MiB for OSC 52; a memory quota for inline images, [terminal] image-memoryAvoids memory exhaustion
The command line tools' links (macOS)Nothing until Lokyr › Install Command Line Tools… is chosen, which links lokyr and sleip into /usr/local/bin: an administrator's rights through osascript, of the system's question of a password, where the account that runs Lokyr may not write there, never a helper tool installed; another program's file or link replaced only once confirmed, a folder never/usr/local/bin is the system's own, and the app holds no rights of its own
Secure Keyboard Entry (macOS)Automatic while the terminal of the focused window echoes nothing in canonical mode, as a password's prompt sets it, which its output and each key tell, never a timer; not in raw mode, as vim's, which echoes itself; Lokyr › Secure Keyboard Entry keeps it on until Lokyr quits; never while another app is active; a 🔒 before the focused window's title while it is onStops other apps from reading keystrokes

Plugins

Packages and the registry

Details in PACKAGE-MANAGER.md.

IPC

IPC is put off, of no phase yet (ROADMAP); its design stays here, as does the MCP server's below.

MCP

The MCP server lets AI agents drive the terminal.

Robustness

macOS environment

Supply chain of our own code