gstack/design/src
Garry Tan 16fca84d04
fix(design): disclose OpenAI key source + warn on cwd .env match (#1278, closes #1248)
The design binary previously called process.env.OPENAI_API_KEY without
checking where the key came from. If a user ran $D inside someone
else's project that had OPENAI_API_KEY in its .env, the resulting
generation billed that project's account. Silent and irreversible.

Fix: resolveApiKeyInfo() returns both the key and its source. When the
env-var path matches an OPENAI_API_KEY entry in the current
directory's .env, .env.<NODE_ENV>, or .env.local file, we set a
warning. requireApiKey() prints "Using OpenAI key from <source>" plus
the warning before the run — never the key itself.

Adds 6 unit tests covering: config-vs-env precedence, env-only (no
match), env+cwd .env match, quoted/exported values, value-mismatch
(no false positive), and the no-leak invariant for requireApiKey
stderr output.

Contributed by @jbetala7 via #1278. Closes #1248.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 21:22:18 -07:00
..
auth.ts fix(design): disclose OpenAI key source + warn on cwd .env match (#1278, closes #1248) 2026-05-18 21:22:18 -07:00
brief.ts feat: design binary — real UI mockup generation for gstack skills (v0.13.0.0) (#551) 2026-03-27 20:32:59 -06:00
check.ts fix: close redundant PRs + friendly error on all design commands (v0.15.8.1) (#817) 2026-04-05 02:02:06 -07:00
cli.ts fix(design): disclose OpenAI key source + warn on cwd .env match (#1278, closes #1248) 2026-05-18 21:22:18 -07:00
commands.ts feat: design binary — real UI mockup generation for gstack skills (v0.13.0.0) (#551) 2026-03-27 20:32:59 -06:00
compare.ts feat: design binary — real UI mockup generation for gstack skills (v0.13.0.0) (#551) 2026-03-27 20:32:59 -06:00
design-to-code.ts feat: design binary — real UI mockup generation for gstack skills (v0.13.0.0) (#551) 2026-03-27 20:32:59 -06:00
diff.ts feat: design binary — real UI mockup generation for gstack skills (v0.13.0.0) (#551) 2026-03-27 20:32:59 -06:00
evolve.ts fix: close redundant PRs + friendly error on all design commands (v0.15.8.1) (#817) 2026-04-05 02:02:06 -07:00
gallery.ts feat: design binary — real UI mockup generation for gstack skills (v0.13.0.0) (#551) 2026-03-27 20:32:59 -06:00
generate.ts fix: user-friendly error when OpenAI org is not verified (#776) 2026-04-05 00:09:32 -07:00
iterate.ts fix: close redundant PRs + friendly error on all design commands (v0.15.8.1) (#817) 2026-04-05 02:02:06 -07:00
memory.ts feat: design binary — real UI mockup generation for gstack skills (v0.13.0.0) (#551) 2026-03-27 20:32:59 -06:00
serve.ts security: tunnel dual-listener + SSRF + envelope + path wave (v1.6.0.0) (#1137) 2026-04-21 21:58:27 -07:00
session.ts fix: security wave 3 — 12 fixes, 7 contributors (v0.16.4.0) (#988) 2026-04-13 07:49:37 -10:00
variants.ts v1.30.0.0 fix wave: 21 community PRs + Windows CI extension + codex flag-semantics smoke (#1391) 2026-05-09 08:06:47 -07:00