T09 · Insecure Skill Coding Practices
Error
- Location
- config.json:2
- Finding
- Hardcoded API Credential Distributed in Project Configuration<![CDATA[ ## Vulnerability Details **File Location**: `config.json:2-5` **Vulnerability Type**: Hardcoded secret / plaintext credential exposure **Risk Level**: High ### Vulnerable Code ```json { "video_api_url": "https://api.onlypixai.com/v1", "video_api_key": "sk-px-97d6f29fb4c79b6f21b7ae000d9dab669a4fa1ab", "text_api_url": "https://api.onlypixai.com/v1", "text_api_key": "sk-px-97d6f29fb4c79b6f21b7ae000d9dab669a4fa1ab", "text_model": "pa/grok-4-1-fast-non-reasoning", "default_video_model": "video/wan2.6-t2v", "default_save_path": "./outputs" } ``` The credential is consumed automatically by the CLI: ```python config = load_config() if args.config and os.path.exists(args.config): with open(args.config, 'r') as f: config = json.load(f) video_api_url = config.get("video_api_url", "") video_api_key = config.get("video_api_key", "") text_api_url = config.get("text_api_url", "") text_api_key = config.get("text_api_key", "") ``` ### Technical Analysis A bearer credential with the structure of a real API token is committed in plaintext. The same token is reused for both text and video services, increasing its effective scope and the consequences of disclosure. Anyone who can download the Skill package, inspect its repository, access a build artifact, or read a previously published version can recover the token without executing the software. Removing it only from the latest file is insufficient if it remains in source-control history, package caches, release archives, or mirrors. The application sends this token in an HTTP `Authorization: Bearer` header. Consequently, possession of the token may be sufficient to invoke the associated provider APIs independently of the Skill. ### Attack Path 1. An attacker obtains the repository, Skill archive, or published release. 2. The attacker reads `config.json`. 3. The attacker extracts the bearer token. 4. The attacker submits requests directly to the configured text or video ...[truncated 702 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke the exposed token immediately and issue a replacement. 2. Remove the token from all current source files, release artifacts, package registries, and downloadable archives. 3. Rewrite source-control history where feasible, while treating the token as compromised regardless of history cleanup. 4. Replace `config.json` with a placeholder-only example file and exclude operational configuration through `.gitignore`. 5. Load credentials from environment variables, a platform secret store, or a dedicated credential manager. 6. Use separate, least-privilege credentials for text and video APIs rather than sharing one token. 7. Add automated secret scanning to pre-commit hooks and CI pipelines. 8. Configure provider-side spending limits, rate limits, expiration, and credential rotation. 9. Avoid printing credentials or including them in exception messages and diagnostics. ]]>
