-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Description
I propose another Addon-App (similar to termux:boot) that gets invoked by termux:command URIs.
Doing this in a seperate app would outsource all the security issues from the core app, be easy to replace and so on.
Control Flow:
- User somehow opens a
termux:URI - Termux:URI parses the URI into:
- Command and args
- Foreground/Background
- possibly more (CWD, ENV, ...)
- Termux:URI does a security check
- Termux:URI sends the command to Termux
URI Encoding
Possibilities of Encoding of command and arguments:
- leave as is:
termux:command arg1 "arg 2"
might not be supported by some apps - URL Encode
termux:command%20arg1%20%22arg2%22
looks ugly - base64 Encode everything
termux:Y29tbWFuZCBhcmcxICJhcmcgMiI=
looks dangerous - let the user decide (see 35.)
Possibilities of Encoding of Foreground Background:
- if the last char of the command is
&its Background
feels very unix - different URI Scheme:
termuxbgbackground.termux.combackground.v1.uri.termux.com - URL Param
termux:command?background=1
would work well with cwd, ... - Configurable outside of URI (see 35.)
Security
My Ideas for security:
- Ask the user: "Dou you want to execute
command arg1 "arg 2"" [YES] [NO] - Configurable Whitelist, Add Button [YES and don't ask again]
- Only commands in
.termux/uri/can be executed. - A whitelist in textform in
.termux/uri/whitelistwith one line per allowed command- do full match ?
- do prefix match? must clean chars like
| ; &&could be unsafe with some commands
- call one single script,
.termux/uri-handlerwith the complete uri, skipping Step 2 and 3 and let it decide what to do.
Additional features
-
Depending on how complicate Step 2 is, a wizard to generate the termux uri would be neat. either in the App, or in javascript, hosted on the termux website. (producing a qr code)
-
Manage the whitelist
Benefit
start commands in TERMUX from:
- all kinds of automation Apps
- QR Codes
- NFC Tags
- other shiny new things
If I'm not mistaken, this would (help to) fix these issues:
termux-tasker # 6
#547
#804
#924
And now?
I have no clue about android programming, but I might enjoy playing around with it. I guess starting off of the termux:boot app to get something working, but I would need help making it into proper android app that follows some kind of coding standard etc.