Files
ruflo/scripts
ruv 7d2fc001ec feat(security): #2089 ADR-127 Phase 2 — github-safe maxBuffer + agent frontmatter tools: + swarm-pr/issue injection fix
github-safe.js (both copies — dogfood + init-template)
  Adds GITHUB_SAFE_VERSION='1.0.0' constant for smoke assertions.
  Adds explicit 256KB body cap (MAX_BODY_BYTES): rejects oversized bodies
  with exit 1 before any temp-file write, matching the GitHub API body
  field limit documented in ADR-127.  Adds strict error handling: all
  execSync calls wrapped in try/catch, cleanup in finally.  Adds
  GITHUB_SAFE_DRY_RUN=1 env-var for smoke tests to skip gh exec.

github-setup.sh (both copies)
  Prepends set -euo pipefail.  Replaces bare `gh auth status &>/dev/null`
  with a check that parses "Logged in" and "repo" scope from the output.
  Adds security rationale comment explaining why each flag is needed.

Agent frontmatter WebFetch removal (dogfood copies only — init-template
commands don't have frontmatter; the relevant change there is the injection
fix below):
  release-manager.md  — removes WebFetch (keeps Write for CHANGELOG)
  release-swarm.md    — removes WebFetch (keeps Write for CHANGELOG)
  repo-architect.md   — removes WebFetch

All 13 agents already have explicit tools: lines; only the 3 above had
WebFetch.  No agent in scope now has WebFetch in its tools: list.

swarm-pr.md + swarm-issue.md (BOTH dogfood .claude/agents/github/ AND
init-template v3/@claude-flow/cli/.claude/commands/github/):
  Replaces unquoted ${{ github.event.comment.body }} interpolated into
  --comment "..." with mktemp + printf + grep + --comment-file pattern.
  Replaces unquoted ${{ github.event.label.name }} == "swarm-ready" with
  mktemp + printf + grep -qx pattern.  Closes prompt-injection path where
  a PR comment with shell metacharacters could execute attacker-controlled
  shell in a pull_request-triggered workflow.

smoke-github-safe-injection.mjs updated:
  Upgrades the >256KB test case from "note" (Phase 1 red) to "ok" (Phase 2
  green) now that the 256KB cap is enforced.

Acceptance checks:
  node scripts/smoke-github-safe-injection.mjs  → all 5 cases pass
  node scripts/smoke-github-actions-pins.mjs    → ok (no regressions)
  grep -r 'github.event.comment.body.*--comment' .claude/agents/ v3/@claude-flow/cli/.claude/
  → exit 1 (no matches)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-21 14:06:59 -04:00
..
2026-01-04 19:30:59 +00:00