T09 · Insecure Skill Coding Practices
- Location
scripts/auth.py:77- Finding
API Key File Is Created Without Restrictive Permissions
- Content
View full analysis
Dict[str, str]: env_vars = {} if UPKUAJING_ENV_FILE.exists(): with open(UPKUAJING_ENV_FILE, 'r', encoding='utf-8') as f: for line in f: line = line.strip() if not line or line.startswith('#'): continue if '=' in line: key, value = line.split('=', 1) env_vars[key.strip()] = value.strip() return env_vars ``` ### Technical Analysis The Skill stores a bearer API key in plaintext at `~/.upkuajing/.env`, but neither the parent directory nor the file is created with an explicit restrictive permission mode. Effective permissions therefore depend on the user's process umask. For example, a common umask of `022` may result in a directory mode of `0755` and a file mode of `0644`. If the user's home directory and parent path are traversable by other local accounts, the API key may be readable by them. The credential storage is necessary for authenticated platform operations, but unrestricted reliance on ambient umask settings exceeds safe minimum-privilege practice. The code also uses a normal pathname-based write without checking file ownership or rejecting symbolic links before overwriting the credential file. ### Attack Path ...[truncated 1316 chars]- Remediation
View remediation
