A short, printable runbook for daily use.
dev, staging, prod) and use matching credentials.--stdin or process env), never in prompt text.make ci) and inspect diffs for accidental secret exposure.| Do | Don’t |
|---|---|
| Inject secrets at runtime with stdin/env | Paste secrets directly into prompts |
| Use separate keys per environment | Reuse one key across dev/stage/prod |
| Rotate credentials on schedule | Keep long-lived tokens forever |
| Redact logs/traces before sharing | Publish raw traces with sensitive fields |
| Revoke immediately on suspicion | Wait for full incident analysis first |
# Store once (stdin avoids shell history leaks)
printf '%s' "$OPENAI_API_KEY" | sk add -k OPENAI_API_KEY --stdin --force
# Load only in the active process/session
export OPENAI_API_KEY="$(sk get -k OPENAI_API_KEY)"
# Optional cleanup when done
unset OPENAI_API_KEY
- name: Load runtime secret from sk
run: |
export OPENAI_API_KEY="$(sk get -k OPENAI_API_KEY)"
your_command_here
printf '%s' "$NEW_OPENAI_API_KEY" | sk add -k OPENAI_API_KEY --stdin --force