T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:25
- Finding
- API Key Exposure Through Command-Line Arguments and Workspace Files<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:25-28`, `SKILL.md:40-43`; `scripts/hivefound.py:192`, `scripts/hivefound.py:201`, `scripts/hivefound.py:209`, `scripts/hivefound.py:215`, `scripts/hivefound.py:220`, `scripts/hivefound.py:225`, `scripts/hivefound.py:230`, `scripts/hivefound.py:237` **Vulnerability Type**: Exposure of authentication credentials through process arguments and insecure storage guidance **Risk Level**: Medium ### Vulnerable Code `SKILL.md:25-28`: ```text Store your key in your workspace (e.g., TOOLS.md or a credentials file): HIVEFOUND_API_KEY=hp_live_xxxx ``` `SKILL.md:40-43`: ```bash python3 SKILL_DIR/scripts/hivefound.py search \ --key "$HIVEFOUND_API_KEY" \ -q "transformer architecture improvements" \ --topics ai,research \ --limit 10 ``` Affected argument declarations in `scripts/hivefound.py`: ```python # submit p = sub.add_parser("submit", help="Submit a discovery") p.add_argument("--key", required=True, help="API key") # feed p = sub.add_parser("feed", help="Browse discoveries") p.add_argument("--key", required=True, help="API key") # search p = sub.add_parser("search", help="Semantic search across discoveries") p.add_argument("--key", help="API key (optional — works without for public search)") # trends p = sub.add_parser("trends", help="Check trending") p.add_argument("--key", required=True, help="API key") # status p = sub.add_parser("status", help="Verify key + check quota") p.add_argument("--key", required=True, help="API key") # upvote p = sub.add_parser("upvote", help="Upvote a discovery") p.add_argument("--key", required=True, help="API key") # downvote p = sub.add_parser("downvote", help="Downvote a discovery") p.add_argument("--key", required=True, help="API key") # flag p = sub.add_parser("flag", help="Flag a discovery") p.add_argument("--key", required=True, help="API key") # used p = sub.add_parser("used", help="Mark a discovery as used in your workflow") p.add_argument("--key ...[truncated 2101 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Read the credential directly from a protected environment variable such as `HIVEFOUND_API_KEY`; do not require it as a command-line argument. 2. Support a secret manager or a credentials file with restrictive permissions, such as mode `0600`, when environment variables are unsuitable. 3. Remove the recommendation to store credentials in `TOOLS.md` or other general-purpose workspace documents. 4. Explicitly require credentials files to be excluded from source control, backups, logs, and agent-readable shared context where possible. 5. Preserve `--key` only as a deprecated compatibility option, display a warning when it is used, and remove it in a subsequent release. 6. Add credential-rotation instructions for users who may already have exposed a key. ]]>
