Skip to content

fix(security): heredoc-quote user task + mktemp for output#16

Open
sahrizvi wants to merge 1 commit into
feat/altimate-code-session-start-hookfrom
fix/shell-injection-mktemp
Open

fix(security): heredoc-quote user task + mktemp for output#16
sahrizvi wants to merge 1 commit into
feat/altimate-code-session-start-hookfrom
fix/shell-injection-mktemp

Conversation

@sahrizvi

Copy link
Copy Markdown
Contributor

The documented altimate-code invocation was:

altimate-code run "<user's task>" \
  --yolo --output /tmp/altimate-result.md --dir "$(pwd)"

Two security-adjacent issues surfaced during the altimate-codex-plugin PR review. This SoT ships the SKILL.md that gets cloned into four sibling plugins, so the canonical fix lives here.

1. Shell injection (HIGH)

Substituting raw user text inside "..." leaves $(...) and backticks live. A task like refactor `whoami` and $(rm -rf ~) gets command-substituted by the shell before altimate-code ever runs, and --yolo removes the confirmation gate. Fix: here-doc the task into a variable, then pass the variable:

TASK="$(cat <<'ALTIMATE_TASK'
<user's task, verbatim>
ALTIMATE_TASK
)"
altimate-code run "$TASK" ...

2. Hardcoded shared output path (MAJOR)

/tmp/altimate-result.md is world-readable, shared across concurrent sessions, and can hold warehouse rows, lineage, or PII findings. Fix: umask 077; OUTPUT_FILE="$(mktemp -t altimate-result.XXXXXX.md)", reuse the variable, delete after reading.

Files changed

  • skills/altimate-code/SKILL.md — delegation skill body (both first-invocation + --continue follow-up blocks)
  • skills/altimate-code/commands/altimate.md/altimate slash command

Base branch

Cut off feat/altimate-code-session-start-hook because the block structure I'm editing (the fast-edit/analyst/builder classification + --continue guidance) doesn't exist on main yet. Once that branch merges to main, this PR rides in cleanly.

Same fix landing in parallel PRs on altimate-claude-plugin, altimate-codex-plugin, and altimate-opencode-plugin.

The documented altimate-code invocation was:

    altimate-code run "<user's task>" --yolo \
      --output /tmp/altimate-result.md --dir "$(pwd)"

Two problems flagged on the altimate-codex-plugin PR review, which
apply to this SoT as well (same SKILL.md content is cloned into four
sibling plugins):

1. **Shell injection.** Substituting raw user text inside a
   double-quoted shell argument leaves `$(...)` and backticks live.
   A task like `refactor `whoami` and $(rm -rf ~)` gets
   command-substituted by the shell before `altimate-code` ever runs,
   and `--yolo` removes the confirmation gate. Fix: heredoc-quote the
   task into a variable, then pass the variable in.

2. **Hardcoded shared output path.** `/tmp/altimate-result.md` is
   world-readable, shared across concurrent sessions, and can hold
   warehouse rows, lineage, or PII findings from a delegation. Fix:
   `umask 077; OUTPUT_FILE="$(mktemp -t altimate-result.XXXXXX.md)"`,
   reuse the variable, delete after reading.

Applied to both `skills/altimate-code/SKILL.md` (the delegation skill
body) and `skills/altimate-code/commands/altimate.md` (the `/altimate`
slash command).

Sibling plugins (altimate-claude-plugin, altimate-codex-plugin,
altimate-opencode-plugin) get the same fix in parallel PRs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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