T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/config.json:2
- Finding
- Hardcoded SaleSmartly API Credential Distributed with the Skill## Vulnerability Details **File Location**: `scripts/config.json:2-4` **Vulnerability Type**: Hardcoded API credential **Risk Level**: High ```json "ss": { "apiKey": "19vLWeRmwTBscpES", "projectId": "b87x3n", ``` ### Technical Analysis The project contains a non-placeholder SaleSmartly API key in a committed configuration file. This key is subsequently used by `scripts/collect.py` as an HTTP bearer credential: ```python req.add_header("Authorization", f"Bearer {self.api_key}") ``` Unlike the placeholder in `config.example.json`, the value in `config.json` appears to be an actual credential. Any person or automated system with access to the project package can extract and attempt to use it. The exposure remains relevant even if the key is later deleted from the latest revision because it may persist in package archives, source-control history, caches, and backups. ### Attack Path 1. An attacker downloads or otherwise obtains the skill package. 2. The attacker opens `scripts/config.json` and extracts the SaleSmartly API key and project identifier. 3. The attacker sends requests to the SaleSmartly API with the key in the `Authorization: Bearer` header. 4. Subject to the key's server-side permissions, the attacker queries session, message, or contact endpoints used by the collector. 5. The attacker retrieves customer conversations and metadata or consumes the credential's API quota. ### Impact Assessment Successful exploitation could provide unauthorized access to the SaleSmartly resources authorized for this API key. The exposed scope may include customer names, contact identifiers, project identifiers, session metadata, and private conversation content. It could also permit API abuse and quota consumption. The exact privileges are limited by the permissions SaleSmartly assigned to the credential.
- Remediation
- ## Remediation Suggestions 1. Revoke and rotate the exposed API key immediately. 2. Remove `scripts/config.json` from all distributed packages and source-control history. 3. Add `config.json` and other secret-bearing files to `.gitignore` and packaging exclusion rules. 4. Load the key from a protected environment variable or dedicated secret manager. 5. Grant the replacement key only the minimum read permissions required by the collector. 6. Add automated secret scanning to CI and release workflows. 7. Review SaleSmartly access logs for use of the exposed key and investigate unexpected requests.
