termux/termux-app
Termux - a terminal emulator application for Android OS extendible by variety of packages.
How termux-app is put together
Termux is an Android terminal emulator and Linux environment app written primarily in Java with native C/C++ components built via the Android NDK. It is a Gradle multi-module project: the `app` module hosts activities, foreground services, and broadcast receivers; `terminal-emulator` implements the VT/xterm emulation engine backed by JNI; `terminal-view` renders the emulator into an Android view; and `termux-shared` provides cross-cutting utilities (files, shell execution, logging, plugins, crash reporting) reused by plugin apps. Data flow: external apps send RUN_COMMAND intents to RunCommandService, which forwards ExecutionCommands to TermuxService; TermuxService spawns shell sessions/tasks whose I/O flows through TerminalSession/TerminalBuffer to TerminalView for rendering. Bootstrap zips are downloaded at build time with SHA-256 verification, embedded as a native shared library, and extracted to $PREFIX on first launch.
Languages
Frameworks
Infrastructure
Major components
app module (com.termux.app)
Hosts the main UI (TermuxActivity), the foreground TermuxService managing sessions/wake locks, RunCommandService plugin entry point, TermuxOpenReceiver, TermuxInstaller, and the DocumentsProvider.
terminal-emulator (com.termux.emulator)
Pure-Java VT100/xterm terminal emulation: TerminalEmulator, TerminalBuffer, TerminalRow, KeyHandler, WcWidth, plus JNI glue (JNI.java, termux.c) for session process handling.
terminal-view (com.termux.view)
Renders the TerminalBuffer to screen via TerminalRenderer/TerminalView, handles gestures/scale recognition and text selection cursors.
termux-shared (com.termux.shared)
Shared library used by Termux and its plugin apps: FileUtils, PermissionUtils, Logger, ExecutionCommand/shell runners, TermuxConstants, plugin policy enforcement, crash handler, ReportActivity, and the termux-am local socket server (local-socket.cpp).
Plugin/RUN_COMMAND intent API
RunCommandService accepts third-party intents carrying executable/arguments/stdin/result config and forwards them to TermuxService after enforcing the allow-external-apps policy.
Bootstrap installer
TermuxInstaller extracts the embedded bootstrap zip into a staging dir then $PREFIX, processing SYMLINKS.txt and setting execute permissions.
File sharing surface
TermuxOpenReceiver and its nested ContentProvider share/read files from Termux home or external storage with other apps under content:// URIs; TermuxDocumentsProvider exposes a DocumentsProvider.
Native layer
NDK-built C/C++: termux-bootstrap.c embeds the bootstrap zip in a .so, termux.c supports the emulator JNI, local-socket.cpp implements the termux-am Unix-domain socket server.
A security fix was made to ensure external apps can't receive command results before proper permissions are verified.
This week's activity on the Termux app repository focused on a single security improvement. The change tightens how the app handles external commands, making sure permission checks happen before any results are shared with other apps. It's a small but important hardening step for users who rely on Termux automation features.
Fix
Security check before sharing command results
The RunCommandService now waits until it has confirmed that an external app is allowed to interact with Termux (via the 'allow-external-app' property) before sending any command results back to a file-based destination, preventing unauthorized apps from receiving results.
Dependencies and code review
Dependency advisories
Security Watch
No known advisories across 0 scanned dependencies.
No known advisories in the scanned dependencies.
Code review
No concrete code-level issues confirmed.
Get this report every week for your repos.
GitZoid learns each repo, reports what changed, and flags what needs attention. One flat price for the whole team.
$19 a month, flat · First 10 outputs free · No card required