Skip to content

feat: grade shell commands by what they run, add self-update command - #4

Merged
bajrangCoder merged 2 commits into
mainfrom
feat/graded-shell-commands
Nov 9, 2026
Merged

bajrangCoder merged 2 commits into
mainfrom
feat/graded-shell-commands

Conversation

@bajrangCoder

Copy link
Copy Markdown
Member

Added

  • Shell commands are graded by what they run instead of every Executor call being High:
    • Low: read-only commands (uname -m, command -v, cat, --version).
    • Medium: visible commands with side effects (apk add, npm install, ln, proot).
    • High: commands the scanner can't see (runtime command name, sh -c $x, eval, piped into a shell).
  • The scanner now follows:
    • command helpers (const sh = c => Executor.execute(c), this.run(cmd))
    • getters (getExecutor())
    • shell-quoting helpers and JSON.stringify
    • functions that build a script from a template
    • $VAR names assigned earlier in the same script
    • proot/chroot wrappers
    • every branch of a ? "x" : "y"
  • Executor.write to a program the plugin started counts as input (Low), not a command.
  • terminal.write is graded by the text it types.
  • diff sends updates that add a new Medium shell command to review and ignores new read-only ones.
  • plugin_scanner update (alias self-update):
    • Updates the installed binary from the latest GitHub release.
    • Flags: --check, --version, --force.
    • Checks the download against the .sha256 file and GitHub's digest, and runs it once before replacing anything.

Fixed

  • destroy_user_data (Critical) no longer fires on paths inside ~, $HOME, /sdcard or /data, such as rm -rf ~/.cache/x.
  • shell_profile_persistence no longer fires on reading /etc/profile.
  • other_app_data no longer flags Acode's own /data/data/com.foxdebug.acode… folder.
  • scheduled_persistence no longer fires on crontab -l.
  • Shell use behind a getExecutor()-style getter was missed entirely.
  • Requiring the terminal module is Medium instead of High.

… call

Every Executor call was High, so every terminal plugin needed review even
when it only ran `uname -m` or `apk add git`.

- Split each command like a shell (`;`, `&&`, `||`, pipes, subshells,
  `$(…)`) and grade each part: read-only commands are Low, visible
  commands with side effects are Medium, and only commands the scanner
  cannot see (runtime command name, `sh -c $x`, `eval`, `node -e`, text
  piped into a shell) are High. Runtime values keep a command at Medium.
- Follow command helpers (`const sh = c => Executor.execute(c)`,
  `this.run(cmd)`), so each call is graded with its own command; closed
  helpers add no finding of their own.
- Resolve getters (`getExecutor()`), which hid all shell use, plus
  shell-quoting helpers, `JSON.stringify`, template-building functions,
  `$VAR` names assigned in the same script, proot/chroot wrappers, and
  every branch of `a ? "x" : "y"`.
- `Executor.write` to a program the plugin started is input (Low), not a
  command. Unknown text typed into a terminal tab is Medium; a runtime
  command followed by Enter is High. Requiring the terminal module is
  Medium.
- Stop dangerous-command look-alikes: `rm -rf ~/.cache/x` is not wiping
  home, reading `/etc/profile` is not persistence, Acode's own data folder
  is not another app's, `crontab -l` is not scheduling.
- `diff` treats a new Medium shell command as a reason to review and
  ignores new read-only ones.
- Bump rules version to 2026.11.1.
Updating meant finding the right release asset by hand and copying it
over the old binary.

`plugin_scanner update` (alias `self-update`) reads the latest release
from the GitHub API, downloads the build for this platform with curl
(or wget), checks it against the published .sha256 and GitHub's own
digest, runs it once with --version, and only then renames it over the
running executable. A failed step leaves the current binary untouched.

- `--check` only reports whether a newer release exists.
- `--version <x>` installs a specific release, including a downgrade.
- `--force` reinstalls the current version.
- A permission error suggests sudo; platforms without a prebuilt build
  point to `cargo install --git`.
@bajrangCoder
bajrangCoder merged commit 33968cf into main Nov 9, 2026
5 checks passed
@bajrangCoder
bajrangCoder deleted the feat/graded-shell-commands branch November 9, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant