T09 · Insecure Skill Coding Practices
- Location
SKILL.md:43- Finding
Insecure CurseForge API Key Storage and Command-Line Handling
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:43-48; supporting implementation atscripts/search_mods.py:1537,scripts/search_mods.py:1647-1648,scripts/search_mods.py:1758-1760, andscripts/search_mods.py:1797
Vulnerability Type: Insecure secret storage and exposure through process arguments
Risk Level: MediumVulnerable Code and Instructions
SKILL.md:43-48:markdown ### CurseForge API Key 配置方法 1. 前往 https://console.curseforge.com/ 申请免费 API Key 2. 编辑 `references/curseforge_api.md`,在文件末尾添加:`CF_API_KEY=你的key` 3. 或设置环境变量:`export CF_API_KEY=你的key` 4. 或运行时通过 `--api-key 你的key` 参数传入scripts/search_mods.py:1537:python cf_api_key = getattr(args, "api_key", None) or os.environ.get("CF_API_KEY", "")The same secret-loading pattern is repeated in the modpack and synchronous search paths:
python cf_api_key = getattr(args, "api_key", None) or os.environ.get("CF_API_KEY", "") cf_has_key, cf_warning = check_curseforge_api_key(cf_api_key)scripts/search_mods.py:1797:python parser.add_argument("--api-key", default=None, help="CurseForge API Key")Technical Analysis
The Skill recommends two unsafe methods of supplying a CurseForge API key:
- Storing the key in
references/curseforge_api.md, a documentation file inside the project repository. - Passing the key through the
--api-keycommand-line option.
A secret stored in a repository file can be accidentally committed to version control, included in archives, copied into reports, exposed to repository collaborators, or retained in source-control history after deletion.
Command-line arguments are also unsuitable for secrets. Depending on the operating system and execution environment, they may be visible through process inspection, audit logs, task monitoring, shell history, CI job logs, or wrapper-tool telemetry.
The repository-file method is additionally inconsistent with the im ...[truncated 1833 chars]
- Storing the key in
- Remediation
View remediation
Remediation Suggestions
- Remove all instructions recommending that users store API keys in
references/curseforge_api.mdor any other tracked project file. - Remove or deprecate the
--api-keyargument to prevent secrets from appearing in process arguments and shell history. - Prefer the existing
CF_API_KEYenvironment variable for noninteractive execution. - For persistent local configuration, use an operating-system credential store or a configuration file outside the repository with owner-only permissions.
- If a local secrets file must be supported, ensure it is excluded through
.gitignore, validate restrictive permissions, and clearly warn users never to commit it. - Avoid printing credentials in exceptions, diagnostics, generated commands, or API failure messages.
- Add secret scanning to CI and document immediate key revocation and rotation procedures for accidental disclosure.
- Update the warning generated by
check_curseforge_api_key()so that it recommends only protected secret-delivery methods.
- Remove all instructions recommending that users store API keys in
