Skip to content

fix(cli): audit round 2 — connect injection fix, charge/ship dedup, README - #75

Merged
fabianocruz merged 1 commit into
mainfrom
feat/cli-audit-round2
Jun 6, 2026
Merged

fix(cli): audit round 2 — connect injection fix, charge/ship dedup, README#75
fabianocruz merged 1 commit into
mainfrom
feat/cli-audit-round2

Conversation

@fabianocruz

Copy link
Copy Markdown
Member

Round 2 of the @codespar/cli audit — closes the gaps the first pass left.

🔴 Security — connect browser-open shell injection

openInBrowser ran exec(\open ${JSON.stringify(url)}`). Double-quoting via JSON.stringifydoes **not** neutralise$(...) or backticks (both stay live inside shell double-quotes), so a malicious/compromised **Connect Link URL** (server-controlled) could run an arbitrary command on the user's machine. Fixed: **execFile(no shell, URL passed as a literal argv)** + reject non-http(s) schemes viaassertHttpUrl` (exported + unit-tested).

Cleanups

  • charge + ship migrated onto the shared meta-input helper — drops the duplicated resolve/parse pair.
  • README — added the meta-tool commands (charge/ship/ledger/issue/discover/wizard/payment-status/verification-status — several were already missing from the table) + the --project flag and CODESPAR_PROJECT.
  • init audited: already safe (name regex blocks ../ traversal; refuses a non-empty existing dir) — no change.

Gate

Core CI is billing-blocked (#73 pending). Verified locally: turbo run build typecheck test54/54, CLI tests 23/23 (added a connect URL-guard test).

🤖 Generated with Claude Code

… dedup, README

- SECURITY: `connect`'s openInBrowser ran exec() with the Connect URL
  double-quoted, but `$(...)` / backticks are still live inside double
  quotes — a malicious/compromised Connect Link could inject a shell
  command on the user's machine. Switched to execFile (no shell, literal
  argv) + reject non-http(s) URLs (assertHttpUrl — exported + tested).
- charge + ship migrated onto the shared meta-input helper, dropping the
  duplicated resolve/parse pair (introduced for ledger/issue in round 1).
- README: added the meta-tool commands (charge / ship / ledger / issue /
  discover / wizard / payment-status / verification-status — several were
  already missing) + the --project flag and CODESPAR_PROJECT env var.
- init audited and left as-is — already safe: the name regex blocks path
  traversal and it refuses to write into a non-empty existing directory.

Gate: turbo build + typecheck + test 54/54 green; CLI tests 23/23.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@fabianocruz
fabianocruz merged commit 5a33b6c into main Jun 6, 2026
0 of 4 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