Skip to content

About

A minimal, locked-down native messenger for Tridactyl

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

tridactyl-emacsclient

A minimal, locked-down Tridactyl native messenger that does exactly one thing: hand the contents of a Firefox textbox to a running Emacs daemon via emacsclient, and read the result back.

Unlike the stock messenger — whose run command executes arbitrary shell — this one implements only the four messages the :editor flow needs (version, temp, read, run) and refuses everything else.

Security posture

  • No shell. run tokenises the command itself and execs directly.
  • Only /usr/bin/emacsclient may be run, with a strict flag allowlist (-c/--create-frame and +line:col positions only) and exactly one file argument. -e/--eval, -a/alternate-editor, -s/socket, -n/no-wait are rejected.
  • Files are confined to a private 0700 directory under $XDG_RUNTIME_DIR (RAM-backed, wiped on logout). Only single-component tmp_edit_*.txt files, owned by you, non-symlink, are read — via O_NOFOLLOW — and deleted after one read.
  • Scrubbed environment, a bounded message/temp-file size and count, and a refusal to run as root.

Because edited text is opened in Emacs, also neutralise file-local-variable attacks in your Emacs init:

(setq enable-local-variables :safe
      enable-local-eval      nil)

Requirements

  • Go (to build), python3 and coreutils install (used by make install)
  • A running Emacs daemon (emacs --daemon) — the messenger forbids alternate-editor, so a server must be up.

Build, test, install

make build       # compile ./messenger
make test        # run the black-box test suite
make roottest    # privilege-dependent tests (uses sudo)
make install     # install per tridactyl.json (see below)
make uninstall

make install treats tridactyl.json as the single source of truth: it installs the binary to the manifest's "path" and the manifest to ~/.mozilla/native-messaging-hosts/<name>.json. Override the manifest directory with make install MANIFEST_DIR=....

Then verify in Firefox with :native.

Configure Tridactyl

set editorcmd /usr/bin/emacsclient -c +%l:%c

Focus a textbox and run :editor (default Ctrl-i).

About

A minimal, locked-down native messenger for Tridactyl

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages