Skip to content

YAGNI/security audit: remove dead code+submodules, harden CLI input, validate spawn-agent skill - #16

Merged
deimagjas merged 4 commits into
mainfrom
chore/yagni-security-audit-and-e2e
Jul 28, 2026
Merged

YAGNI/security audit: remove dead code+submodules, harden CLI input, validate spawn-agent skill#16
deimagjas merged 4 commits into
mainfrom
chore/yagni-security-audit-and-e2e

Conversation

@deimagjas

Copy link
Copy Markdown
Owner

Summary

Multi-agent audit of the repo (dead code / YAGNI, security in app/cli/src/, spawn-agent skill), plus the follow-up work requested to close out the deferred items. Full narrative in log.md.

  • Submodule cleanup: removed model/gemma3-finetunning and app/agents-templates — neither was referenced anywhere outside a README tree diagram.
  • CLI security fixes:
    • q CLI now rejects malformed/malicious --branch values (blocks flag injection, absolute paths, path traversal) and --task values containing control characters, on every command that accepts them.
    • print_agent_status verifies the resolved status-file path stays inside $AGENTS_HOME.
    • config/entrypoint.sh now JSON-escapes task text and commit messages before writing status.json, so a quote or newline in a task description can't produce invalid JSON.
  • YAGNI cleanup: dropped the unused rich direct dependency, a needless from __future__ import annotations, a one-use alias, and a stale completed plan doc.
  • spawn-agent skill hardening: SKILL.md now requires assigning TASK/BRANCH via a single-quoted heredoc (prevents host-side $(...)/backtick expansion when a user's task text gets inlined into a shell-evaluated command), and the eval fixtures no longer hardcode the qubits-team project name. Re-validated with a fresh eval run (iteration-3): 11/11 evals, 100%/100% pass rate vs. the pre-edit baseline, delta +0.00 — no regression, and the new heredoc guidance is followed correctly.
  • Also synced ~/.claude/skills/spawn-agent/ (the global, non-versioned skill install) to match this repo's copy — it had drifted and was missing the AGENT_MODEL section and the new heredoc guidance.

Deliberately deferred / not in this PR: the OAuth token remaining visible in container run's host process argv (config/Makefile:100,130) — a fix was designed (--env-file + a mktemp/trap-cleaned temp file, confirmed supported by Apple Container CLI) but paused at the user's request; see log.md for the exact diff if picked back up later.

Test plan

  • uv run pytest (unit + acceptance, app/cli/) — 135 passed
  • uv run ruff check . — clean
  • make mutation-ci-threshold — 95.2% (178/187), threshold 70%
  • shellspec --shell bash (entrypoint, config/) — 59 examples, 0 failures
  • STACKAI_E2E=1 uv run pytest tests/e2e -v -m e2e (real containers) — 2 passed (Claude agent round-trip + PI agent round-trip against a rebuilt claude-pi:ubuntu image and a live local mlx_lm.server)
  • spawn-agent skill evals (iteration-3, .claude/skills/spawn-agent-workspace/iteration-3/, gitignored) — 100%/100%, delta +0.00 vs. iteration-2 baseline

🤖 Generated with Claude Code

deimagjas and others added 4 commits July 27, 2026 15:11
…-templates)

Neither submodule was referenced anywhere in code, the Makefile, CI, or docs
beyond a project-structure tree diagram in README.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…dead code

Security audit findings:
- q CLI: reject branch names outside [A-Za-z0-9._/-] (blocks flag injection,
  absolute paths, path traversal) and task text with control characters,
  across every command that accepts --branch/--task. print_agent_status
  additionally verifies the resolved path stays inside $AGENTS_HOME.
- config/entrypoint.sh: escape task text and commit messages before
  interpolating them into status.json, so quotes/newlines in a task
  description can no longer produce invalid JSON.

YAGNI cleanup:
- Drop the unused "rich" direct dependency (Typer already pulls it in
  transitively; nothing in this package imports it).
- Drop a needless from __future__ import annotations and a one-use
  agents_app alias.
- Remove plans/testing-ci-acceptance-tdd.md — the plan it describes is
  already implemented and undocumented elsewhere.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…efix

- SKILL.md: add a "Step 0" that requires assigning BRANCH/TASK through a
  single-quoted heredoc before it ever touches a shell-evaluated command
  string, so user task text can't trigger host-side $(...)/backtick
  expansion when inlined into container run / make invocations.
- evals/: replace the hardcoded "qubits-team" project-name prefix with a
  generic <project-name> (basename of git root) derivation, so the evals
  stay valid if the repo is cloned under a different directory name.

Re-validated with a fresh iteration-3 eval run (11 evals, with_skill vs.
pre-edit baseline): 100%/100% pass rate, delta +0.00 — no regression, and
the new Step 0 guidance is followed correctly in the sampled responses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Records the multi-agent audit that produced the other commits on this
branch: confirmed/refuted findings, what was fixed vs. deliberately
deferred, and the e2e/skill-eval verification that followed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@deimagjas
deimagjas merged commit 394f0f4 into main Jul 28, 2026
9 checks passed
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