fix(security): heredoc-quote user task + mktemp for output#2
Conversation
The documented invocation for altimate-code was:
altimate-code run "<user's task>" \
--yolo --output /tmp/altimate-result.md --dir "$(pwd)"
Two problems the reviewers on the codex-plugin PR flagged (and which
this SKILL.md is the source-of-truth for across 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 `commands/altimate.md` (the `/altimate` slash command), which
each documented the same pattern.
Also verified with PyYAML that the frontmatter description still parses
cleanly and contains the exact trigger token `altimate-code` (not the
folded `altimate- code` regression the codex-plugin PR review caught).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| ALTIMATE_TASK | ||
| )" | ||
| umask 077 | ||
| OUTPUT_FILE="$(mktemp -t altimate-result.XXXXXX.md)" |
There was a problem hiding this comment.
SUGGESTION: Move the Xs to the end of the mktemp template for consistent cross-platform behavior.
mktemp randomizes the trailing run of Xs in the template. Here .md follows the XXXXXX, so behavior is inconsistent: GNU coreutils expects trailing Xs and may reject this template (mktemp: too few X's in template 'altimate-result.XXXXXX.md'), while BSD/macOS mktemp -t treats the whole argument as a literal prefix and appends its own random suffix, leaving XXXXXX verbatim in the filename. The .md extension is cosmetic (the file is read and then deleted), so trailing Xs are both portable and simpler. The identical call recurs on line 55 — apply to both.
| OUTPUT_FILE="$(mktemp -t altimate-result.XXXXXX.md)" | |
| OUTPUT_FILE="$(mktemp -t altimate-result.XXXXXX)" |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| ALTIMATE_TASK | ||
| )" | ||
| umask 077 | ||
| OUTPUT_FILE="$(mktemp -t altimate-result.XXXXXX.md)" |
There was a problem hiding this comment.
SUGGESTION: Move the Xs to the end of the mktemp template for consistent cross-platform behavior.
mktemp randomizes the trailing run of Xs in the template. Here .md follows the XXXXXX, so behavior is inconsistent: GNU coreutils expects trailing Xs and may reject this template (mktemp: too few X's in template 'altimate-result.XXXXXX.md'), while BSD/macOS mktemp -t treats the whole argument as a literal prefix and appends its own random suffix, leaving XXXXXX verbatim in the filename. The .md extension is cosmetic (the file is read and then deleted), so trailing Xs are both portable and simpler. The identical call recurs on line 88 — apply to both.
| OUTPUT_FILE="$(mktemp -t altimate-result.XXXXXX.md)" | |
| OUTPUT_FILE="$(mktemp -t altimate-result.XXXXXX)" |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Optional — address if convenient Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
The here-doc + Fix these issues in Kilo Cloud Reviewed by glm-5.2 · Input: 60.9K · Output: 37.5K · Cached: 445.5K |
The documented altimate-code invocation was:
Two security-adjacent issues raised on the altimate-codex-plugin PR #2 review — since this SKILL.md content is the source-of-truth cloned across four sibling plugins, fixing here first:
1. Shell injection (HIGH)
Substituting raw user text inside
"..."leaves$(...)and backticks live. A task likerefactor `whoami` and $(rm -rf ~)gets command-substituted by the shell beforealtimate-codeever runs, and--yoloremoves the confirmation gate. Fix: here-doc the task into a variable, then pass the variable:2. Hardcoded shared output path (MAJOR)
/tmp/altimate-result.mdis 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
plugins/altimate-code/skills/altimate-code/SKILL.md— delegation skill body (both first-invocation +--continuefollow-up blocks)plugins/altimate-code/commands/altimate.md—/altimateslash commandVerified with PyYAML that the frontmatter still parses cleanly and the description contains the exact trigger token
altimate-codeintact.Same fix will land in
data-engineering-skills(the wider SoT),altimate-codex-plugin(PR #2), andaltimate-opencode-plugin(PR #3) in parallel.