Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

privacy: limit update credentials, device logs, and note permissions

RoversXe44fb0cedba0
diff --git a/PRIVACY.md b/PRIVACY.md
index 11d91715..68a2072a 100644
--- a/PRIVACY.md
+++ b/PRIVACY.md
@@ -42,7 +42,11 @@ notify you if that is the case.
The content of that request is private between your machine and GitHub. The
contributors to ThinkTerm cannot see inside that request and therefore cannot
-infer any information from it.
+infer any information from it. The request is anonymous: it carries no
+credentials unless you set `THINKTERM_UPDATE_TOKEN` yourself, which is only
+useful for reaching a private fork. (The `install.sh` script, which you run
+by hand, honours `GITHUB_TOKEN` for the same purpose; the app never reads
+that variable.)
If you wish, you can disable update checking by setting
`check_for_updates = false`.
diff --git a/android/app/src/main/java/com/roversx/thinkterm/TerminalModel.kt b/android/app/src/main/java/com/roversx/thinkterm/TerminalModel.kt
index db279709..99f29d2c 100644
--- a/android/app/src/main/java/com/roversx/thinkterm/TerminalModel.kt
+++ b/android/app/src/main/java/com/roversx/thinkterm/TerminalModel.kt
@@ -489,8 +489,15 @@ class TerminalModel(
// MARK: the log
+ // Pane titles, remote stderr and user@host pass through here; logcat
+ // is readable by other apps with the right permission and by anyone
+ // with adb, so only a debuggable build writes it there. The in-app
+ // log view keeps the lines either way.
+ private val debuggable =
+ (context.applicationInfo.flags and android.content.pm.ApplicationInfo.FLAG_DEBUGGABLE) != 0
+
fun log(line: String) {
- Log.i("thinkterm", line)
+ if (debuggable) Log.i("thinkterm", line)
logLines.addLast(line)
while (logLines.size > 60) logLines.removeFirst()
logText = logLines.joinToString("\n")
diff --git a/install.sh b/install.sh
index af470521..eac54c75 100755
--- a/install.sh
+++ b/install.sh
@@ -25,7 +25,9 @@
# GITHUB_TOKEN in the environment is sent with every request. It is what lets
# the script work against a private repository -- the API and the release
# assets both refuse anonymous access there -- and lifts the anonymous API
-# rate limit on a public one.
+# rate limit on a public one. This script is something you run yourself; the
+# app's own background update check deliberately does not read GITHUB_TOKEN
+# and takes THINKTERM_UPDATE_TOKEN instead (see PRIVACY.md).
#
# Windows has an installer on the releases page; this script stops there.
#
diff --git a/thinkterm-update/src/lib.rs b/thinkterm-update/src/lib.rs
index 3e0c69a6..52fe80f5 100644
--- a/thinkterm-update/src/lib.rs
+++ b/thinkterm-update/src/lib.rs
@@ -180,9 +180,11 @@ pub fn http_get(uri: &str) -> anyhow::Result<Vec<u8>> {
request
.version(HttpVersion::Http10)
.header("User-Agent", &format!("thinkterm/{}", config::wezterm_version()));
- // The same convention as install.sh: a token lifts the anonymous API
- // rate limit and is what makes a private repository reachable at all.
- let auth = std::env::var("GITHUB_TOKEN")
+ // A token lifts the anonymous API rate limit and is what makes a
+ // private repository reachable at all. It has to be one meant for
+ // this: the GUI runs this check on its own, and a GITHUB_TOKEN the
+ // user exported for other tools must not be sent anywhere by it.
+ let auth = std::env::var("THINKTERM_UPDATE_TOKEN")
.ok()
.filter(|t| !t.trim().is_empty())
.map(|t| format!("Bearer {}", t.trim()));
diff --git a/wezterm-gui/src/markdown_editor/store.rs b/wezterm-gui/src/markdown_editor/store.rs
index 7375a12f..1d819869 100644
--- a/wezterm-gui/src/markdown_editor/store.rs
+++ b/wezterm-gui/src/markdown_editor/store.rs
@@ -342,7 +342,12 @@ fn write_bytes_atomic(path: &Path, bytes: &[u8]) -> Result<()> {
#[cfg(unix)]
fn set_user_document_permissions(path: &Path, permissions: Option<fs::Permissions>) {
use std::os::unix::fs::PermissionsExt;
- let permissions = permissions.unwrap_or_else(|| fs::Permissions::from_mode(0o644));
+ // A Note without a mode to inherit is the user's own document: 0600,
+ // the same as the temporary it was written through, and never wider
+ // than the umask this process runs under. Vault folders are the
+ // user's and are not tightened, so 0644 here read to every other
+ // account on a shared machine.
+ let permissions = permissions.unwrap_or_else(|| fs::Permissions::from_mode(0o600));
if let Err(err) = fs::set_permissions(path, permissions) {
log::warn!(
"failed to preserve Note permissions on {}: {err:#}",
@@ -358,6 +363,19 @@ fn set_user_document_permissions(_path: &Path, _permissions: Option<fs::Permissi
mod tests {
use super::*;
+ #[cfg(unix)]
+ #[test]
+ fn new_notes_are_private_and_existing_permissions_are_preserved() {
+ use std::os::unix::fs::PermissionsExt;
+ let dir = tempfile::tempdir().unwrap();
+ let path = dir.path().join("note.md");
+ write_bytes_atomic(&path, b"private note").unwrap();
+ assert_eq!(fs::metadata(&path).unwrap().permissions().mode() & 0o777, 0o600);
+ fs::set_permissions(&path, fs::Permissions::from_mode(0o640)).unwrap();
+ write_bytes_atomic(&path, b"updated note").unwrap();
+ assert_eq!(fs::metadata(&path).unwrap().permissions().mode() & 0o777, 0o640);
+ }
+
#[test]
fn creates_and_reuses_a_vault_document_session() {
let temp = tempfile::tempdir().unwrap();