Skip to content

fix(bin): pass settings path and hook command via env vars#858

Open
garagon wants to merge 1 commit intogarrytan:mainfrom
garagon:fix/settings-hook-env-vars
Open

fix(bin): pass settings path and hook command via env vars#858
garagon wants to merge 1 commit intogarrytan:mainfrom
garagon:fix/settings-hook-env-vars

Conversation

@garagon
Copy link
Copy Markdown
Contributor

@garagon garagon commented Apr 6, 2026

What

Replace direct shell variable interpolation inside bun -e scripts with
environment variables read via process.env in gstack-team-init and
gstack-settings-hook.

Why

Same pattern fixed in #819 (gstack-learnings-search): shell variables
interpolated into JavaScript string literals allow paths containing quotes
to break the string context.

A settings path like /tmp/it's-a-test/settings.json produces:

const settingsPath = '/tmp/it's-a-test/settings.json';
//                              ^ JS parse error here

Environment variables are read as-is by process.env without shell
interpretation.

Files

  • bin/gstack-team-init: $SETTINGSprocess.env.GSTACK_SETTINGS_PATH
  • bin/gstack-settings-hook: $SETTINGS_FILEprocess.env.GSTACK_SETTINGS_PATH, $HOOK_CMDprocess.env.GSTACK_HOOK_CMD

Same fix pattern as garrytan#819: replace direct shell variable interpolation
inside bun -e scripts with environment variables read via process.env.

Shell interpolation of $SETTINGS_FILE and $HOOK_CMD into JavaScript
string literals allows paths containing quotes to break out of the
string context and execute arbitrary code.

Files changed:
- bin/gstack-team-init: $SETTINGS → process.env.GSTACK_SETTINGS_PATH
- bin/gstack-settings-hook: $SETTINGS_FILE → process.env.GSTACK_SETTINGS_PATH,
  $HOOK_CMD → process.env.GSTACK_HOOK_CMD (also removes nested bun subprocess)
@garagon
Copy link
Copy Markdown
Contributor Author

garagon commented Apr 6, 2026

CI note: the E2E eval failures require ANTHROPIC_API_KEY which is not available on fork PRs. Free tests (build-image) pass. The change only replaces shell variable interpolation with process.env reads in two bin scripts — no impact on eval test paths.

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