-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclaude-safe
More file actions
executable file
·33 lines (27 loc) · 1.21 KB
/
Copy pathclaude-safe
File metadata and controls
executable file
·33 lines (27 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Wrapper to launch Claude Code with sensitive env vars scrubbed.
# Usage: claude-safe [any claude args]
#
# Prevents accidental leakage of tokens/keys via environment variables.
# Your git/npm/aws still work through their configured credential helpers.
# --- Scrub cloud provider tokens ---
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_DEFAULT_REGION
unset GOOGLE_APPLICATION_CREDENTIALS GOOGLE_API_KEY GCLOUD_PROJECT
unset AZURE_CLIENT_ID AZURE_CLIENT_SECRET AZURE_TENANT_ID
# --- Scrub dev tool tokens ---
unset GITHUB_TOKEN GH_TOKEN GITLAB_TOKEN BITBUCKET_TOKEN
unset NPM_TOKEN NPM_CONFIG_TOKEN
unset PYPI_TOKEN TWINE_USERNAME TWINE_PASSWORD
unset DOCKER_USERNAME DOCKER_PASSWORD DOCKER_CONFIG
unset HOMEBREW_GITHUB_API_TOKEN
# --- Scrub API keys ---
unset OPENAI_API_KEY ANTHROPIC_API_KEY STRIPE_SECRET_KEY STRIPE_API_KEY
unset SENDGRID_API_KEY TWILIO_AUTH_TOKEN SLACK_TOKEN SLACK_BOT_TOKEN
unset TELEGRAM_BOT_TOKEN TELEGRAM_API_KEY
unset DATABASE_URL REDIS_URL MONGODB_URI
# --- Scrub SSH agent (prevents remote key use) ---
unset SSH_AUTH_SOCK SSH_AGENT_PID
# --- Prevent git from using stored credentials silently ---
export GIT_TERMINAL_PROMPT=1
# --- Launch Claude Code ---
exec claude "$@"