Skip to content

Support safe agent-side API key usage without secret echo #170

@justrach

Description

@justrach

Problem

When using CodeGraff from an agentic coding environment, users may paste a cg_sk_ key into chat and ask the agent to run a live SDK/API smoke test. The agent can technically call the SDK/API, but command strings and tool outputs are recorded in transcripts/logs.

Current options are awkward:

  1. Put CODEGRAFF_API_KEY inline in a shell command, which records the secret.
  2. Ask the user to manually export it outside the agent session, which blocks autonomous testing.
  3. Decline the live test even though the key was intentionally provided for agent use.

This happened while trying to run a minimal @codegraff/sdk smoke test with model deepseek-v4. The SDK installed and imported, but the live call was blocked by secret-handling concerns.

Expected behavior

Provide an agent-friendly way to run one-off local tests without echoing the API key into commands or logs.

Potential fixes:

  • CLI reads key from stdin without printing it, e.g. codegraff auth set --stdin or codegraff smoke --api-key-stdin.
  • SDK/CLI supports reading a key from a file path with clear gitignore guidance.
  • Document a short-lived test-token flow for coding agents.
  • Provide a documented deepseek-v4 smoke command that uses env-only auth and avoids inline shell secrets.
  • Add redaction guidance/helpers for agent environments where command strings are persisted.

Repro context

  1. npm install @codegraff/sdk
  2. Verify import works from Node and exports Graff plus Sandbox.
  3. Attempt a live smoke call with a pasted cg_sk_ key and model deepseek-v4.

The blocker is safe secret handling, not SDK installation/import.

Security note

Any key pasted into chat should be treated as exposed and rotated after use. This issue is about making the intended agent-use case safer and less likely to leak secrets into transcripts/logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions