T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:20
- Finding
- API key requested through chat and persisted in source code## Vulnerability Details **File Location**: `SKILL.md:20-24` **Related Location**: `pixelhub_api_runner.py:13`, `pixelhub_api_runner.py:282-284` **Vulnerability Type**: Secret exposure through insecure collection and hardcoded storage **Risk Level**: High ### Vulnerable Code ```markdown 3. Tell the user to copy their own Pixelle API key and send it in chat. 4. After the user sends the key, replace `DEFAULT_API_KEY` in `pixelhub_api_runner.py`. 5. After the key is written, change this file's status line from `PENDING_USER_API_KEY` to `API_KEY_ADDED`. 6. After that, do not ask for the API key again unless the user wants to replace it. ``` The destination in which the instructions require the key to be stored is: ```python DEFAULT_API_KEY = "PENDING_USER_API_KEY" ``` The runner also already supports an environment variable, making source-code persistence unnecessary: ```python p.add_argument( "--api-key", default=os.getenv("Pixelhub_API_KEY", DEFAULT_API_KEY), help="Pixelhub API key", ) ``` ### Technical Analysis The setup instructions explicitly require the user to disclose an API credential in chat and direct the agent to replace a constant in the Python source file with that credential. This creates two persistent secret-exposure surfaces: 1. The credential remains in chat history and any associated telemetry, exports, or backups. 2. The credential becomes part of the local skill source and can subsequently be copied, archived, shared, or committed to version control. Storing the key in source code violates secret-management best practices and is not necessary for the skill's declared operation. The runner already reads `Pixelhub_API_KEY` from the environment. A protected environment injection mechanism or credential store would provide the required authentication without modifying package files. No evidence indicates that the package contains a preinstalled real credential. The r ...[truncated 1167 chars]
- Remediation
- ## Remediation Suggestions 1. Remove all instructions asking users to submit API keys through chat. 2. Remove the instruction to replace `DEFAULT_API_KEY` in the source file. 3. Require the existing `Pixelhub_API_KEY` environment variable or integrate an operating-system credential store or managed secret provider. 4. Keep `DEFAULT_API_KEY` as a non-secret sentinel and fail safely when no externally supplied credential is available. 5. Document secure, platform-specific secret injection without printing the key to the terminal or logs. 6. Add secret-scanning controls to development and release workflows. 7. Ensure local secret configuration files are excluded from source control. 8. Advise users who followed the old procedure to remove the embedded key, delete exposed copies where possible, and rotate the credential through the Pixelle account portal.
