T09 · Insecure Skill Coding Practices
- Location
scripts/music_skill.py:658- Finding
Spotify Access Token Exposure Through Command-Line Arguments
- Content
View full analysis
Optional[str]: return cli_token or os.environ.get("SPOTIFY_ACCESS_TOKEN") or None ``` ```python p_play.add_argument( "--spotify-token", dest="spotify_token", help="Optional: Spotify Web API access token; if omitted, SPOTIFY_ACCESS_TOKEN may be read from the environment", ) ``` The documented usage also encourages supplying the credential through the environment: ```bash export SPOTIFY_ACCESS_TOKEN="" python3 scripts/music_skill.py play "Phoenix Legend Lotus Pond Moonlight" --app spotify --control-mode macos-ui --spotify-market JP ``` ### Technical Analysis The `--spotify-token` option permits an OAuth bearer token to be supplied directly in the process command line. Command-line arguments can be recorded in shell history and may be observable through process-inspection interfaces, endpoint monitoring products, diagnostic tools, or process-accounting systems. The environment-variable fallback avoids placing the token directly in shell history when used carefully, but environment variables may still be inherited by child processes or exposed to sufficiently privileged local inspection tools. The token is sent only to the fixed official endpoint `https://api.spotify.com/v1/search`, so the network transmission itself is consistent with the declared Spotify lookup feature. The vulnerability concerns local credential handling rather than unauthorized exfiltration by the Skill. ### Attack Path 1. A user invokes the Skill with `--spotify-token `. 2. The bearer token becomes part of the Python process command line and may also remain in shell history. 3. A malicious local process, another user with applicabl ...[truncated 958 chars]- Remediation
View remediation
