T09 · Insecure Skill Coding Practices
- Location
references/config.json:2- Finding
Plaintext API key can be transmitted to an untrusted configurable endpoint
- Content
View full analysis
Vulnerability Details
File Location:
references/config.json:2-3,INSTALL.md:29-35,scripts/create_task_enhanced.py:25-34
Vulnerability Type: Plaintext credential storage and insufficient endpoint validation
Risk Level: MediumThe same configuration and request pattern is also used by
scripts/create_task.py,scripts/create_task_smart.py,scripts/list_tasks.py,scripts/reports.py, andscripts/update_task.py.Vulnerable Code
references/config.json:1-5:json { "baseUrl": "https://mytaskline.com/api/v1", "apiKey": "YOUR_MYTASKLINE_API_KEY_HERE", "timezone": "America/Denver" }INSTALL.md:29-38:markdown 1. Open `references/config.json` in the skill directory 2. Replace the placeholder with your actual API key: ```json { "baseUrl": "https://mytaskline.com/api/v1", "apiKey": "your-actual-api-key-here", "timezone": "America/Denver" }text `scripts/create_task_enhanced.py:25-34`: ```python config = load_config() headers = {"X-API-Key": config["apiKey"]} if data: headers["Content-Type"] = "application/json" url = f"{config['baseUrl']}/{endpoint.lstrip('/')}" if method == "GET": response = requests.get(url, headers=headers)Technical Analysis
Installation explicitly instructs users to save a full-access API key in a plaintext file inside the project directory. This can expose the credential through accidental source-control commits, backups, archive sharing, permissive filesystem permissions, or access by another local process or user.
The request implementation also trusts the configured
baseUrlwithout verifying its scheme or hostname. The API key is attached to requests made to that URL. If the configuration is modified to reference an attacker-controlled server or an unencrypted HTTP endpoint, subsequent operations disclose the key in theX-API-Keyheader. Query operations may additionally di ...[truncated 1519 chars]- Remediation
View remediation
Remediation Suggestions
- Read the API key from a protected environment variable or operating-system secret manager rather than a tracked project file.
- Keep only a non-secret example such as
config.example.jsonin the package. - Add the live configuration file and common secret files to
.gitignore. - Restrict any unavoidable credential file to the owning user, such as mode
0600on supported systems. - Reject placeholder, empty, or malformed keys before making a request.
- Parse
baseUrland require thehttpsscheme. - Allowlist the expected hostname, such as
mytaskline.com, unless custom deployments are an intentional feature. If custom endpoints are required, require explicit user confirmation before sending credentials to a new origin. - Use separate least-privilege API tokens for read-only reporting and mutating operations if the service supports scoped credentials.
- Document immediate key revocation and rotation procedures for accidentally committed or shared keys.
- Avoid printing full server response bodies where they could contain sensitive account or task information.
