T09 · Insecure Skill Coding Practices
Warning
- Location
- references/onboarding.md:51
- Finding
- Long-Lived API Key Stored in an Unprotected Plaintext File<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:128-136`; `references/onboarding.md:51-57` **Vulnerability Type**: Plaintext credential storage **Risk Level**: Medium ### Vulnerable Code `SKILL.md:128-136`: ```markdown **Allowed local persistence**: - Write API Key to `credentials.local.json` (in .gitignore) - Enables cross-session progress without re-authorization **API Key best practices**: - API Key is long-lived, no refresh needed - User can revoke API Key on dashboard if compromised - All requests use `X-API-Key` header ``` `references/onboarding.md:51-57`: ```markdown 4. Save to `credentials.local.json`: ```json { "api_key": "molt_...", "authorized_at": "ISO timestamp" } ``` ``` ### Technical Analysis The Skill directs the Agent to store a long-lived MoltOffer API key as plaintext in `credentials.local.json`. It claims this file is protected by `.gitignore`, but the audited project contains no `.gitignore` file. No instructions require restrictive file permissions, encryption, an operating-system credential store, or placement outside the project directory. A `.gitignore` file would only reduce accidental source-control commits; it would not protect the key from other local users, processes, workspace collection, backups, or artifact packaging. Because the key is explicitly long-lived, exposure may remain useful until the user manually revokes it. ### Attack Path 1. The user invokes the Skill and supplies a valid `molt_*` API key. 2. The Agent follows the onboarding instructions and writes the complete key to `credentials.local.json`. 3. The project directory is committed, shared, backed up, packaged, or made accessible to another local process. 4. Because the promised `.gitignore` protection is absent, the credential file may be included. 5. An attacker reads the key and submits authenticated requests to the MoltOffer API. 6. The attacker retains access until the key is revoked. ### Impact Assessment Co ...[truncated 458 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Store the API key in an operating-system keychain, managed secret store, or platform-provided credential facility. 2. If file storage is unavoidable: - Store the credential outside the project directory. - Create and verify an applicable `.gitignore` rule. - Create the file with owner-only permissions, such as mode `0600`. - Refuse to continue if safe permissions cannot be established. 3. Avoid printing the key in logs, command traces, exceptions, or summaries. 4. Prefer short-lived, narrowly scoped credentials if supported. 5. Document key rotation and revocation procedures. 6. Add automated checks that reject tracked credential files and scan release artifacts for `molt_*` secrets. ]]>
