T09 · Insecure Skill Coding Practices
- Location
SKILL.zh-CN.md:21- Finding
Plaintext API Token Persistence and Command-Line Credential Exposure
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.zh-CN.md:21-48;scripts/google_hotels.py:258, 649-656
Vulnerability Type: Plaintext credential storage and unsafe credential input
Risk Level: MediumVulnerable Code
SKILL.zh-CN.md:21-48recommends permanently storing the token in plaintext shell initialization files:markdown ## 设置 DATAIFY_API_TOKEN 推荐使用永久环境变量,而不是只在当前终端临时设置。 Windows PowerShell,当前用户永久设置: ```powershell [Environment]::SetEnvironmentVariable("DATAIFY_API_TOKEN", "your_token_here", "User")然后重新打开 PowerShell。如果当前会话也要立即生效,再执行:
powershell $env:DATAIFY_API_TOKEN = "your_token_here"macOS 或 Linux,bash 永久设置:
bash echo 'export DATAIFY_API_TOKEN="your_token_here"' >> ~/.bashrc source ~/.bashrcmacOS 或 Linux,zsh 永久设置:
bash echo 'export DATAIFY_API_TOKEN="your_token_here"' >> ~/.zshrc source ~/.zshrctext `scripts/google_hotels.py:258` permits the secret to be supplied on the command line: ```python parser.add_argument("--token", help="Dataify API token. Bearer prefix is optional.")scripts/google_hotels.py:649-656also copies the normalized authorization value back into the process environment:python def get_authorization(token_arg: str | None) -> str | None: token = clean_value(token_arg) or clean_value(os.environ.get("DATAIFY_API_TOKEN")) if not token: return None if not token.lower().startswith("bearer "): token = f"Bearer {token}" os.environ["DATAIFY_API_TOKEN"] = token return tokenTechnical Analysis
The localized instructions recommend writing the API token directly into
.bashrc,.zshrc, or a persistent user-level Windows environment variable. These locations are plaintext configuration stores that may be read by other processes executing as the same user, included in backups, collected in diagnostics, synchronized between systems, or accidentally ...[truncated 2551 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the recommendation to place plaintext tokens in
.bashrc,.zshrc, or persistent user environment variables by default. - Make the English and localized instructions consistent. Recommend a session-scoped environment variable first:
- POSIX shells:
export DATAIFY_API_TOKEN="..." - PowerShell:
$env:DATAIFY_API_TOKEN = "..." - Command Prompt:
set DATAIFY_API_TOKEN=...
- POSIX shells:
- For persistent storage, recommend an operating-system credential manager or secret-management service rather than shell initialization files.
- Deprecate or remove
--token. If compatibility requires retaining it, display a warning that command-line secrets may be exposed through shell history and process listings. - Remove
os.environ["DATAIFY_API_TOKEN"] = token. Keep the normalized authorization value only in local memory and pass it directly tocall_api. - Continue preventing token values from appearing in dry-run output, logs, errors, result tables, telemetry, and dashboard attribution parameters.
- Document token rotation and revocation procedures for users who may already have stored credentials in plaintext.
- Add automated tests that verify generated output and error handling never contain the supplied token or the complete
Authorizationheader.
- Remove the recommendation to place plaintext tokens in
