T09 · Insecure Skill Coding Practices
- Location
scripts/setup-auth.sh:100- Finding
OAuth Access Token and Client Secret Exposed in Plaintext
- Content
View full analysis
Vulnerability Details
File Location:
scripts/setup-auth.sh, lines 100-127
Vulnerability Type: Plaintext credential exposure and insecure credential storage
Risk Level: MediumThe setup script displays the complete OAuth access token in terminal output, embeds it in a configuration example, and saves both the access token and client secret in a project-local JSON file without enforcing restrictive file permissions.
Affected code segments:
scripts/setup-auth.sh:100-101,scripts/setup-auth.sh:108-116, andscripts/setup-auth.sh:119-127bash echo "Access Token: ${ACCESS_TOKEN}" echo "" echo "=== Next Steps ===" echo "" echo "Add to your Claude Code settings (~/.claude/settings.json):" echo "" cat << SETTINGS_EOF { "env": { "NEODB_TOKEN": "${ACCESS_TOKEN}", "NEODB_INSTANCE": "${INSTANCE}" } } SETTINGS_EOF echo "" echo "Or export in your shell:" echo "" echo " export NEODB_TOKEN='${ACCESS_TOKEN}'" echo " export NEODB_INSTANCE='${INSTANCE}'" echo "" # Save credentials locally CRED_FILE="$(dirname "$0")/.credentials.json" cat > "$CRED_FILE" << CRED_EOF { "instance": "${INSTANCE}", "client_id": "${CLIENT_ID}", "client_secret": "${CLIENT_SECRET}", "access_token": "${ACCESS_TOKEN}", "username": "${USERNAME}", "created_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)" } CRED_EOF echo "Credentials saved to: ${CRED_FILE}" echo "(Add .credentials.json to .gitignore!)"Technical Analysis
OAuth bearer tokens function as credentials: possession is normally sufficient to authenticate API requests. Printing the complete token exposes it to terminal capture, session transcripts, screen sharing, CI logs, or other logging systems. The generated settings and shell-export examples repeat the token, further increasing its exposure surface.
The script also writes the access token and OAuth client secret to `scripts/.credentials.js ...[truncated 2091 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not print the complete access token. Display only a short masked fingerprint when confirmation is necessary.
- Do not emit configuration examples containing live credentials. Instead, provide instructions that reference a protected environment variable or credential store.
- Store credentials in an operating-system credential manager or secret-management service where available.
- If file storage is unavoidable, place the file outside the project and enforce owner-only access before writing:
bash umask 077 CRED_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/neodb/credentials.json" mkdir -p "$(dirname "$CRED_FILE")" install -m 600 /dev/null "$CRED_FILE" - Write credentials atomically and verify that the destination is not a symbolic link and is owned by the current user.
- Add
.credentials.jsonto a committed.gitignoreas defense in depth, while recognizing that ignore rules do not replace secure permissions. - Request the narrowest OAuth scopes supported by NeoDB and separate read-only from write-enabled workflows where possible.
- Document how users can revoke or rotate an exposed token and recommend immediate revocation if the credential file or terminal output has been disclosed.
