Skip to content

fix: security hardening + setup resilience + Codex flags + cross-platform open#639

Open
raf-andrew wants to merge 1 commit intogarrytan:mainfrom
raf-andrew:fix/security-setup-codex-cross-platform
Open

fix: security hardening + setup resilience + Codex flags + cross-platform open#639
raf-andrew wants to merge 1 commit intogarrytan:mainfrom
raf-andrew:fix/security-setup-codex-cross-platform

Conversation

@raf-andrew
Copy link
Copy Markdown

Summary

Five independent fixes bundled into one community PR. Each is scoped to a small number of files with no cross-dependencies.

Fix Issue Files
Auto-install Bun in setup #466 setup
JSON validation in gstack-review-log #472 bin/gstack-review-log
JSONL injection sanitization in telemetry #469 bin/gstack-telemetry-log
Codex CLI flags (xhighhigh, --enable web_search_cached--search, P0+P1 gate) #426 codex/SKILL.md.tmpl
Cross-platform gstack-open (replaces macOS-only open) #475 bin/gstack-open (new), scripts/gen-skill-docs.ts, scripts/resolvers/preamble.ts, office-hours/SKILL.md.tmpl

Fix details

setup: auto-install Bun (#466)

Previously hard-failed with a manual install instruction. Now auto-runs curl -fsSL https://bun.sh/install | bash and re-exports PATH so the rest of setup continues in the same shell. Falls back to the manual instruction on curl failure.

gstack-review-log: JSON validation (#472)

echo "$1" wrote any string — including multi-line inputs — directly to the JSONL file. A maliciously crafted argument could inject extra JSONL lines or corrupt the file. Fix: reject inputs containing \n, then validate JSON structure via node or python3 if available.

gstack-telemetry-log: JSONL sanitization (#469)

User-controlled fields (SKILL, SESSION_ID, OUTCOME, SOURCE, ERROR_CLASS, etc.) were interpolated into printf format strings without escaping. A \n in any field would create a new JSONL line; a " would break the JSON structure. Fix: add sanitize_str() that strips \n/\r and escapes \ and " before embedding any field.

codex flags (#426)

  • model_reasoning_effort="xhigh""high" (xhigh causes an unsupported_value API error)
  • --enable web_search_cached--search (deprecated feature flag)
  • Gate verdict now fails on [P0] in addition to [P1]

gstack-open (#475)

The preamble uses open https://garryslist.org/posts/boil-the-ocean to show the Boil the Lake essay. open is macOS-only — on Linux and Windows it silently does nothing or errors. bin/gstack-open dispatches to the correct launcher per platform: open (macOS), xdg-open/sensible-browser (Linux), explorer.exe/cmd.exe start (WSL), start "" (Windows Git Bash).

Test plan

  • ./setup with Bun uninstalled: auto-installs and completes
  • gstack-review-log $'{"a":1\nb":2}': rejected (newline injection)
  • gstack-review-log 'not-json': rejected (invalid JSON)
  • gstack-telemetry-log --skill $'qa\n{"injected":1}' --outcome success: newline stripped from JSONL output
  • /codex review with updated flags: no unsupported_value API error
  • bin/gstack-open https://example.com on Linux: opens browser via xdg-open

🤖 Generated with Claude Code

…m open

setup (garrytan#466):
- Auto-install Bun if missing instead of hard-failing with a manual instruction.
  Runs curl | bash and re-exports PATH so the rest of setup proceeds without
  the user having to open a new terminal.

bin/gstack-review-log (garrytan#472):
- Validate JSON input before appending to JSONL. Reject multi-line inputs
  (JSONL injection) and malformed JSON (using node or python3 if available).
  Use printf instead of echo to avoid trailing-newline ambiguity.

bin/gstack-telemetry-log (garrytan#469):
- Add sanitize_str() helper that strips \n/\r and escapes backslashes and
  double-quotes before embedding user-controlled fields into JSONL records.
  Apply to SKILL, SESSION_ID, EVENT_TYPE, OUTCOME, SOURCE, REPO_SLUG,
  BRANCH, ERROR_CLASS, ERROR_MESSAGE, FAILED_STEP.

codex/SKILL.md.tmpl (garrytan#426):
- Replace deprecated model_reasoning_effort="xhigh" with "high" (xhigh is
  rejected by the API with unsupported_value).
- Replace --enable web_search_cached with --search (deprecated feature flag).
- Expand gate verdict to fail on [P0] as well as [P1] findings.
- Update explanatory prose to match corrected flags.

bin/gstack-open + generator scripts (garrytan#475):
- Add bin/gstack-open: cross-platform URL opener for macOS (open), Linux
  (xdg-open / sensible-browser / x-www-browser), WSL (explorer.exe /
  cmd.exe start), and Windows Git Bash (start).
- Replace bare `open https://...` calls in gen-skill-docs.ts,
  scripts/resolvers/preamble.ts, and office-hours/SKILL.md.tmpl with
  ~/.claude/skills/gstack/bin/gstack-open so the Boil the Lake essay
  link works on all platforms.

Co-Authored-By: Claude Sonnet 4.6 <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