NC-AUTH-002

No API tokens in workspace files

🟠 High ⚗️ Experimental ⚗️ Experimental not scored

What this checks

Scans workspace files for exposed API tokens and credentials.

Why it matters

API tokens in workspace files can be accidentally committed to version control or accessed by unauthorized users.

How to fix it

Step 1 Identify which files contain exposed tokens. The audit finding's detail field will list the files and token patterns detected. You can also check manually:

openclaw security audit --json | jq '.findings[] | select(.checkId=="security.secrets.tokens_in_workspace") | .detail'

Step 2 Remove the token from the file. Edit the flagged file and replace the hardcoded value with an environment variable reference or a placeholder comment. For example, in a TOOLS.md or config file:

# Before (insecure)
API_KEY: sk-abc123...

# After (safe)
API_KEY: $MY_API_KEY  # set in environment

Step 3 Set the token as an environment variable. Add it to your shell profile or a .env file that is not inside the workspace:

# In ~/.zshrc or ~/.bash_profile
export MY_API_KEY="sk-abc123..."

Step 4 Rotate the exposed token. Since the token was present in a file (and potentially committed to git), treat it as compromised. Revoke it in the relevant service dashboard and issue a new one. Check your git history too:

git log --all -p | grep -i "sk-\|token\|secret" | head -20

Step 5 Verify: Re-run openclaw security audit --json and confirm security.secrets.tokens_in_workspace no longer appears.

Technical details

FieldValue
Control IDNC-AUTH-002
DomainAUTH
SeverityHigh
StatusExperimental
Data sourceworkspace_scan
Source typederived
ModeMode 1 (OpenClaw native)
Introduced inLibrary v0.1.0
OWASP LLM 2025LLM02: Sensitive Information Disclosure

False positive notes

May match non-token strings that look like tokens. Higher false-positive risk than authoritative checks.

Suppress this finding

If this finding is intentional or not applicable to your setup, you can exclude it:

clawvitals exclude NC-AUTH-002 reason "your reason here"

Exclusions are auditable and expire automatically. See the exclusions guide.